backend #1
11
.idea/dataSources.xml
Normal file
11
.idea/dataSources.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="db" uuid="7f4bb91e-1fe8-4fbb-957b-243ac1847b2b">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/rest-app/db.sqlite3</jdbc-url>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2020-11-30 21:19
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('user', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='user',
|
||||||
|
table='user',
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
@ -69,4 +69,4 @@ class User(AbstractBaseUser):
|
|||||||
"""
|
"""
|
||||||
Class to set table name in database
|
Class to set table name in database
|
||||||
"""
|
"""
|
||||||
db_table = 'login'
|
db_table = 'user'
|
||||||
|
0
rest-app/smartpicasso/app/user_profile/__init__.py
Normal file
0
rest-app/smartpicasso/app/user_profile/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
rest-app/smartpicasso/app/user_profile/admin.py
Normal file
3
rest-app/smartpicasso/app/user_profile/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
5
rest-app/smartpicasso/app/user_profile/apps.py
Normal file
5
rest-app/smartpicasso/app/user_profile/apps.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class UserProfileConfig(AppConfig):
|
||||||
|
name = 'user_profile'
|
@ -0,0 +1,30 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2020-11-30 21:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('user', '0002_auto_20201130_2119'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='UserProfile',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('first_name', models.CharField(max_length=50)),
|
||||||
|
('last_name', models.CharField(max_length=50)),
|
||||||
|
('phone_number', models.CharField(blank=True, max_length=10, null=True)),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to='user.user')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'db_table': 'user_profile',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
24
rest-app/smartpicasso/app/user_profile/models.py
Normal file
24
rest-app/smartpicasso/app/user_profile/models.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
"""
|
||||||
|
@author p.dolata
|
||||||
|
"""
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
from django.db import models
|
||||||
|
from smartpicasso.app.user.models import User
|
||||||
|
|
||||||
|
|
||||||
|
class UserProfile(models.Model):
|
||||||
|
"""
|
||||||
|
Model representing user's profile
|
||||||
|
"""
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
|
||||||
|
first_name = models.CharField(max_length=50, unique=False)
|
||||||
|
last_name = models.CharField(max_length=50, unique=False)
|
||||||
|
phone_number = models.CharField(max_length=10, unique=False, null=True, blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""
|
||||||
|
Meta to se table name in database
|
||||||
|
"""
|
||||||
|
db_table = 'user_profile'
|
3
rest-app/smartpicasso/app/user_profile/tests.py
Normal file
3
rest-app/smartpicasso/app/user_profile/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
rest-app/smartpicasso/app/user_profile/views.py
Normal file
3
rest-app/smartpicasso/app/user_profile/views.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
@ -38,7 +38,8 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
'smartpicasso.app.user'
|
'smartpicasso.app.user',
|
||||||
|
'smartpicasso.app.user_profile'
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
Loading…
Reference in New Issue
Block a user