Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Marta Miranda
/
boletin_api
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Enzo Yair
2023-09-19 10:36:26 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
02fa6d4852f52cca3b04774884fdf2ed74bd97f7
02fa6d48
1 parent
70307cf7
se agrego atributo editable y se elimino field de read_only_fields
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
32 deletions
project/apps/edicto/migrations/0016_remove_edicto_usuario_and_more.py
project/apps/edicto/migrations/0016_rename_usuario_edicto_creado_por_and_more.py
project/apps/edicto/migrations/0017_remove_edicto_id_alter_edicto_uuid.py
project/apps/edicto/migrations/0018_alter_edicto_fecha_modificacion.py
project/apps/edicto/models.py
project/apps/edicto/serializer.py
project/apps/edicto/migrations/0016_remove_edicto_usuario_and_more.py
0 → 100644
View file @
02fa6d4
# Generated by Django 4.1.9 on 2023-09-19 13:23
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
(
'edicto'
,
'0015_edicto_usuario_movi'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'edicto'
,
name
=
'usuario'
,
),
migrations
.
RemoveField
(
model_name
=
'edicto'
,
name
=
'usuario_movimiento'
,
),
migrations
.
AddField
(
model_name
=
'edicto'
,
name
=
'creado_por'
,
field
=
models
.
ForeignKey
(
editable
=
False
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
,
verbose_name
=
'Usuario'
),
preserve_default
=
False
,
),
migrations
.
AddField
(
model_name
=
'edicto'
,
name
=
'modificado_por'
,
field
=
models
.
ForeignKey
(
editable
=
False
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'udate_edicto'
,
to
=
settings
.
AUTH_USER_MODEL
),
preserve_default
=
False
,
),
]
...
...
project/apps/edicto/migrations/0016_rename_usuario_edicto_creado_por_and_more.py
deleted
100644 → 0
View file @
70307cf
# Generated by Django 4.1.9 on 2023-09-19 12:40
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0015_edicto_usuario_movi'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'edicto'
,
old_name
=
'usuario'
,
new_name
=
'creado_por'
,
),
migrations
.
RenameField
(
model_name
=
'edicto'
,
old_name
=
'usuario_movimiento'
,
new_name
=
'modificado_por'
,
),
]
project/apps/edicto/migrations/0017_remove_edicto_id_alter_edicto_uuid.py
0 → 100644
View file @
02fa6d4
# Generated by Django 4.1.9 on 2023-09-19 13:29
from
django.db
import
migrations
,
models
import
uuid
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0016_remove_edicto_usuario_and_more'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'edicto'
,
name
=
'id'
,
),
migrations
.
AlterField
(
model_name
=
'edicto'
,
name
=
'uuid'
,
field
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
primary_key
=
True
,
serialize
=
False
,
unique
=
True
),
),
]
...
...
project/apps/edicto/migrations/0018_alter_edicto_fecha_modificacion.py
0 → 100644
View file @
02fa6d4
# Generated by Django 4.1.9 on 2023-09-19 13:34
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0017_remove_edicto_id_alter_edicto_uuid'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'edicto'
,
name
=
'fecha_modificacion'
,
field
=
models
.
DateTimeField
(
auto_now
=
True
),
),
]
...
...
project/apps/edicto/models.py
View file @
02fa6d4
...
...
@@ -25,8 +25,8 @@ class Precio (models.Model):
class
Edicto
(
models
.
Model
):
uuid
=
models
.
UUIDField
(
unique
=
True
,
editable
=
False
,
default
=
uuid4
)
creado_por
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Usuario'
)
uuid
=
models
.
UUIDField
(
unique
=
True
,
editable
=
False
,
default
=
uuid4
,
primary_key
=
True
)
creado_por
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Usuario'
,
editable
=
False
)
cuerpo_edicto
=
models
.
TextField
(
blank
=
False
,
null
=
False
)
archivo
=
models
.
FileField
(
upload_to
=
"uploads/
%
Y/
%
m/
%
d/"
,
null
=
False
,
blank
=
False
)
dias_publicar
=
models
.
PositiveIntegerField
(
blank
=
False
,
null
=
False
)
...
...
@@ -36,9 +36,9 @@ class Edicto(models.Model):
cantidad_copias
=
models
.
PositiveIntegerField
(
blank
=
False
,
null
=
False
)
fecha_publicacion
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
observaciones
=
models
.
CharField
(
max_length
=
500
,
blank
=
True
,
null
=
True
)
fecha_creacion
=
models
.
DateField
(
auto_now_add
=
True
)
fecha_modificacion
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modificado_por
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
related_name
=
'udate_edicto'
)
fecha_creacion
=
models
.
DateField
(
auto_now_add
=
True
,
editable
=
False
)
fecha_modificacion
=
models
.
DateTimeField
(
auto_now
=
True
,
editable
=
False
)
modificado_por
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
related_name
=
'udate_edicto'
,
editable
=
False
)
class
Meta
:
verbose_name
=
'Edicto'
...
...
project/apps/edicto/serializer.py
View file @
02fa6d4
...
...
@@ -32,10 +32,7 @@ class EdictoSerializer(serializers.ModelSerializer):
)
read_only_fields
=
(
'creado_por'
,
'modificado_por'
,
'fecha_publicacion'
,
'cantidad_palabras'
,
'fecha_creacion'
,
'fecha_modificacion'
,
read_only_fields
=
(
'fecha_publicacion'
,
'cantidad_palabras'
,
)
def
validate
(
self
,
data
):
...
...
Please
register
or
login
to post a comment