develop #8

Merged
s460930 merged 7 commits from develop into master 2020-12-17 17:03:01 +01:00
7 changed files with 59 additions and 2 deletions
Showing only changes of commit ee9261f504 - Show all commits

Binary file not shown.

View 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',
},
),
]

View File

@ -1,3 +1,29 @@
"""
@author p.dolata
"""
import uuid
from django.db import models 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'

View File

@ -22,6 +22,6 @@ class UserProfile(models.Model):
class Meta: class Meta:
""" """
Meta to se table name in database Meta to set table name in database
""" """
db_table = 'user_profile' db_table = 'user_profile'