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
Marta Miranda
2023-09-08 11:10:57 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5cce44002007037502c4cc041c3fd539b55bad9a
5cce4400
1 parent
87db16a0
Closed feature/#45_agregar_uuid_a_los_edictos
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
project/apps/edicto/migrations/0011_edicto_uuid.py
project/apps/edicto/migrations/0012_migracion_dato_uuid.py
project/apps/edicto/models.py
project/apps/edicto/migrations/0011_edicto_uuid.py
0 → 100644
View file @
5cce440
# Generated by Django 4.1.9 on 2023-09-08 11:10
from
django.db
import
migrations
,
models
import
uuid
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0010_alter_edicto_fecha_creacion'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'edicto'
,
name
=
'uuid'
,
field
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
),
),
]
...
...
project/apps/edicto/migrations/0012_migracion_dato_uuid.py
0 → 100644
View file @
5cce440
# Generated by Django 4.1.9 on 2023-09-08 11:19
from
django.db
import
migrations
,
models
import
uuid
def
migrar_datos_uuid
(
apps
,
schema
):
Edictos
=
apps
.
get_model
(
'edicto'
,
'Edicto'
)
for
edicto
in
Edictos
.
objects
.
all
():
edicto
.
uuid
=
uuid
.
uuid4
()
edicto
.
save
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0011_edicto_uuid'
),
]
operations
=
[
migrations
.
RunPython
(
migrar_datos_uuid
,
reverse_code
=
migrations
.
RunPython
.
noop
),
migrations
.
AlterField
(
model_name
=
'edicto'
,
name
=
'uuid'
,
field
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
unique
=
True
),
),
]
...
...
project/apps/edicto/models.py
View file @
5cce440
from
django.db
import
models
from
uuid
import
uuid4
from
.constants
import
STATUS_CHOICE
,
MONEDA
from
usuario.models
import
Usuario
...
...
@@ -24,6 +25,7 @@ class Precio (models.Model):
class
Edicto
(
models
.
Model
):
uuid
=
models
.
UUIDField
(
unique
=
True
,
editable
=
False
,
default
=
uuid4
)
usuario
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Usuario'
)
cuerpo_edicto
=
models
.
TextField
(
blank
=
False
,
null
=
False
)
archivo
=
models
.
FileField
(
upload_to
=
"uploads/
%
Y/
%
m/
%
d/"
,
null
=
False
,
blank
=
False
)
...
...
Please
register
or
login
to post a comment