develop #8
Binary file not shown.
Binary file not shown.
Binary file not shown.
31
rest-app/smartpicasso/app/project/migrations/0001_initial.py
Normal file
31
rest-app/smartpicasso/app/project/migrations/0001_initial.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 3.1.3 on 2020-12-14 19:08
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Project',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=100)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'project',
|
||||
},
|
||||
),
|
||||
]
|
@ -1,3 +1,29 @@
|
||||
"""
|
||||
@author p.dolata
|
||||
"""
|
||||
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
from smartpicasso.app.user.models import User
|
||||
|
||||
|
||||
class Project(models.Model):
|
||||
"""
|
||||
Model representing user's project
|
||||
"""
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=100)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
Meta to set table name in database
|
||||
"""
|
||||
db_table = 'project'
|
||||
|
Binary file not shown.
@ -22,6 +22,6 @@ class UserProfile(models.Model):
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
Meta to se table name in database
|
||||
Meta to set table name in database
|
||||
"""
|
||||
db_table = 'user_profile'
|
||||
|
Loading…
Reference in New Issue
Block a user