From 234669242fb382e6968896efe88e77ac53d9ee90 Mon Sep 17 00:00:00 2001 From: Andrew Smirnov Date: Thu, 4 Feb 2021 20:37:58 +0300 Subject: [PATCH] Add profile model, update requirements, readme and gitignore --- .gitignore | 2 +- README.md | 1 + access_controller/settings.py | 2 ++ main/migrations/0001_initial.py | 22 ++++++++++++++++++++++ main/models.py | 7 ++++++- media/.gitkeep | 0 requirements.txt | 1 + 7 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 main/migrations/0001_initial.py create mode 100644 media/.gitkeep diff --git a/.gitignore b/.gitignore index 6fa11b8..191bf6a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ __pycache__/ local_settings.py db.sqlite3 db.sqlite3-journal -media +media/ # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ # in your Git repository. Update and uncomment the following line accordingly. diff --git a/README.md b/README.md index 67e5621..56d4810 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,4 @@ pip install -r requirements.txt ## Read more - Zenpy: [http://docs.facetoe.com.au](http://docs.facetoe.com.au) +- Zendesk API: [https://developer.zendesk.com/rest_api/docs/](https://developer.zendesk.com/rest_api/docs/) diff --git a/access_controller/settings.py b/access_controller/settings.py index cd05a4c..dc44189 100644 --- a/access_controller/settings.py +++ b/access_controller/settings.py @@ -124,3 +124,5 @@ STATIC_URL = '/static/' STATICFILES_DIRS = [ 'static' ] + +MEDIA_ROOT = BASE_DIR / 'media' diff --git a/main/migrations/0001_initial.py b/main/migrations/0001_initial.py new file mode 100644 index 0000000..d3f4d97 --- /dev/null +++ b/main/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.6 on 2021-02-04 17:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='UserProfile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('role', models.IntegerField()), + ('image', models.ImageField(upload_to='media/user_avatars')), + ], + ), + ] diff --git a/main/models.py b/main/models.py index 71a8362..3512e99 100644 --- a/main/models.py +++ b/main/models.py @@ -1,3 +1,8 @@ +import os + from django.db import models -# Create your models here. + +class UserProfile(models.Model): + role = models.IntegerField() + image = models.ImageField(upload_to=os.path.join('media', 'user_avatars')) diff --git a/media/.gitkeep b/media/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt index 3283ef1..0128b55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ Django==3.1.6 +Pillow==8.1.0