Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ManyToManyField along with different additional value for each
I have the following models: class Course(models.Model): Name = CharField(max_length=32, unique=True,) class Tutorial(models.Model): Name = CharField(max_length=64, unique=True,) Courses = ManyToManyField(Course,) Index = PosSmallInt() There are many Courses and every Course has Tutorials, but there are some Courses that share the same Tutorials. Now, every Tutorial should have a unique Index in the Course that it's inside of. I think I should point out that the Courses(ManyToManyField) was a regular Course(ForeignKey) not long ago, which means I had duplicate Tutorials, and I had this line in the Meta class of Tutorial: unique_together = (('Course', 'Index')) to keep Course from having different Tutorials in the same Index. But now that it's a ManyToManyField it's not possible. Example: I have the following Courses with their Tutorials: C#: Syntax Conditions Loops Python: Conditions Loops Lambdas (For the sake of the example please consider "Conditions" and "Loops" to have the exact same information.) How can I have same Tutorials in different Courses with different Indexes? -
Running Django selenium tests with the parallel flag
My Selenium tests fail when I run them with the --parallel flag and give this error: selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed I'm assuming that this is the result of running them in parallel, since they work just fine otherwise, but I'm not sure what I need to change to make them work? I've been able to find plenty of information about testing in parallel from before the introduction of the flag (1.9) when third party packages were required, but nothing more recent. The setup for my tests looks like this: class LoginTestCase(LiveServerTestCase): def setUp(self): capabilities = webdriver.DesiredCapabilities.CHROME if self.CAPABILITIES: for capability, option in self.CAPABILITIES.items(): capabilities[capability] = option self.browser = webdriver.Remote( command_executor=settings.SELENIUM_WEBDRIVER_URL, desired_capabilities=capabilities ) super().setUp() def tearDown(self): self.browser.quit() super().tearDown() -
django- how to address static files in 404.html template
according to django's documentation: When you raise Http404 from within a view, Django loads a special view devoted to handling 404 errors. By default, itβs the view django.views.defaults.page_not_found(), which either produces a very simple βNot Foundβ message or loads and renders the template 404.html if you created it in your root template directory. , i created a 404.html file in the root template directory. when the app raises a 404 error, this 404.html that i created before, will shown but it's css and it's background image not show. this is the 404.html file code: <!DOCTYPE html>{% load staticfiles %} <html> <head> <title>not found</title> <link rel="stylesheet" href="{% static 'css/error_style.css' %}"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/> </head> <body class="color-404"> <div id="error"> <img class="error-image" src="{% static 'img/404.jpg' %}"/> </div> <div class="error-router"> <a href="#" class="gohome"><i class="fa fa-home"></i></a> <a href="" onclick="window.history.back();" class="goback"><i class="fa fa-arrow-left"></i></a> </div> </body> </html> how can i fix this problem? tanx -
Django django-user-accounts blank template
I have followed the instructions for installing and setting up django-user-accounts. However I have a problem with the templates. When I try to access the views such as http://127.0.0.1:8000/account/settings/ I'm shown a template that just contains {# This template intentionally left blank to satisfy test suites. Your project should always provide a site_base.html itself. #} I've tried to add a site_base.html to templates but it has no effect. I've tried the both the main app and in separate account directory. Any help is much appreciated. -
Wagtail CMS Snippets for Index to Detail Page
I am building an interface for a party rental company and am utilizing snippets for them to add and update product information. I'm utilizing the SnippetChooserPanel to add the products to the page and its awesome, but I am a little confused how to setup an index page to list all the snippets on the page, but have them hyperlink to a detail page for a full display of the snippet data (exactly how a typical Blog index/detail page setup would be) With the code below my url looks like www.domain.com/product-name but I would like to have www.domain.com/products/product-name. I hope this makes sense; thank you for your help. product snippet @register_snippet class Product(models.Model): title = models.CharField(max_length=255) description = models.TextField(blank=True) ... panels = [ FieldPanel('title'), FieldPanel('description'), ... ] def __str__(self): return self.title product child model and product page class ProductPageProductPlacement(Orderable, models.Model): page = ParentalKey('ProductPage', related_name='product_placements') product = models.ForeignKey('Product', related_name='+') class Meta: verbose_name = "product placement" verbose_name_plural = "product placements" panels = [ SnippetChooserPanel('product'), ] def __str__(self): return self.page.title class ProductPage(Page): intro = RichTextField(blank=True) content_panels = Page.content_panels + [ FieldPanel('intro', classname='full'), InlinePanel('product_placements', label="Products"), ] -
How can I limit http method to a Django REST api
How can I change the api_view decorator in the Function Based View to Class Based View? My requirement is, I want to limit the HTTP access methods such as GET, POST, PUT etc to a particular API @api_view(['GET', 'POST']) def hello_world(request): if request.method == 'POST': return Response({"message": "Got some data!", "data": request.data}) return Response({"message": "Hello, world!"}) Hope someone know the answer ..... -
Python Unresolved reference
hi im trying learning python and when i created a new app and want to install it i write the name but getting the error that the referene is unresolved. i guessing that my main website doesnt see a .py files because i got a folder in app called migrations so when i write the nick app. it suggest only the migration folders but i need to write app.apps.MusicConfig or something. here is the print screen. i tried to intall the oldest version 2,7 but it is all the same... Settings.py: INSTALLED_APPS = [ 'django.contrib.admin', 'music.apps.MusicConfig', <-- that line cause the error 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] -
NoReverseMatch error in django when added a form
I created an app called jobs in my django project. I included the jobs urls.py file to my main urls.py file. urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', views.HomeView.as_view(), name="home"), url(r'^jobs/', include('jobs.urls', namespace="jobs")), ] In my jobs urls.py file I have a url. urlpatterns = [ url(r'^post/', views.post_view, name="post"), ] Here is the view code for this url. def post_view(request): form = forms.PostJobForm() return render(request, 'jobs/post_job_form.html', {'form': form}) Here is the html for this form. {% extends 'layout.html' %} {% block title %}Post a Job{% endblock %} {% block content %} <form action="" method="POST"> {{ form.as_p }} <input type="submit" value="Post Job"/> </form> {% endblock %} Here is the actual form python code. class PostJobForm(forms.Form): title = forms.CharField(max_length=30) description = forms.CharField(widget=forms.Textarea) Ever since I added these things to my project, nothing seems to work. Whenever I run the local development server and go to http://127.0.0.1:8000/, which is the route url of the project or any other url for that matter, I get this error: NoReverseMatch at /jobs/post/ Reverse for 'jobs.views.' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] It later says it is a template rendering error which occurs at line 0. What's going on and how β¦ -
django-image-cropping does not show cropping tool in the admin
I'm trying to make django-image-cropping to work. I did the following steps: pip install django-image-cropping settings.py INSTALLED_APPS = [ [..] 'easy_thumbnails', 'image_cropping', ] [..] THUMBNAIL_DEBUG = True from easy_thumbnails.conf import Settings as thumbnail_settings THUMBNAIL_PROCESSORS = ( 'image_cropping.thumbnail_processors.crop_corners', ) + thumbnail_settings.THUMBNAIL_PROCESSORS models.py class AboutImg(models.Model): image = models.ImageField(blank=True, null=True, upload_to='uploaded_images') cropping = ImageRatioField('image', '500x480') admin.py class MyModelAdmin(ImageCroppingMixin, admin.ModelAdmin): pass admin.site.register(AboutImg, MyModelAdmin) views.py def about(request): aboutimg = AboutImg.objects.order_by('pub_date').first() context = {'aboutimg': aboutimg} return render(request, 'about.html', context) about.html {% load cropping %} <img src="{% cropped_thumbnail aboutimg "cropping" %}" class="img-responsive wooimg" alt="{{aboutimg.title}}" title="{{aboutimg.title}}" /> when I create a new istance of object AboutImg in the admin, the cropping field looks like that: When I save the instance of AboutImg in the admin panel, I've also noticed that in my upload_images/ folder two more images are created from the base image 05_2.jpg: 05_2_l3l0SL7.jpg 05_2_l3l0SL7.jpg.1425x500_q85_detail_upscale.jpg and if I open the instance just created in the admin, now the base image is no more 05_2.jpg but 05_2_l3l0SL7.jpg. I've checked all the stackoverflow questions about this subject, but none of the answers are ok with me. Thank you for your help. -
Django 1.10.5: relation 'myapp_mymodel' does not exist even after migrating
I have a django app "myapp" with this in model.py: from django.db import models from django.contrib.postgres.fields import ArrayField class Characteristic(models.Model): name = models.CharField(max_length=200) core = models.BooleanField(default=False) synonyms = ArrayField( models.CharField(max_length=200, blank=True), size=20 ) And in the same folder, I have a migrations folder with an empty init.py and 2 files: 0001_initial.py from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='characteristics', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('synonyms', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=200), size=20)), ], ), ] Second file: from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myapp', '0001_initial'), ] operations = [ migrations.AddField( model_name='characteristics', name='core', field=models.BooleanField(default=False), ), ] However, in a view, when trying to create an instance of the model: characteristic = Characteristic(name=attribute.decode('utf-8'), synonyms=[]) characteristic.save() I get an error: ProgrammingError: relation "myapp_characteristic" does not exist I did do: python manage.py makemigrations myapp and I have at the top of the file from myapp.models import Characteristic Does anyone know where I'm wrong ? -
Django Migration File Not Writing SQL/Creating table
I'm having a real devil of a time with Django v1.10 at the moment. Everything was working wonderfully as I set up and built out my first real project. In addition to running through the tutorial I started building a custom interface to a PostgreSQL and everything was behaving exactly as described. However, I recently tried to add another model and found that while the migration gave me the OK status upon completion, it had not actually modified my database. I restarted with a fresh project and got the same behavior. I am using a db_router file to route the various apps I'm building out to different schema but I don't think that is problem. Just in case, here is the database section of my settings.py file: DATABASE_ROUTERS = ['routers.db_router.AuthRouter','routers.db_router.coeff_db','routers.db_router.emp_db'] DATABASES = { 'coeffs': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': conf['DEFAULT']['Host'], 'PORT': conf['DEFAULT']['Port'], 'NAME': conf['DEFAULT']['Name'], 'OPTIONS':{ 'options': '-c search_path=nn_itemsite_inv_analysis,public' }, 'USER': conf['DEFAULT']['User'], 'PASSWORD': conf['DEFAULT']['Password'], }, 'emp_products': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': conf['DEFAULT']['Host'], 'PORT': conf['DEFAULT']['Port'], 'NAME': conf['DEFAULT']['Name'], 'OPTIONS':{ 'options': '-c search_path=emp_products,public' }, 'USER': conf['DEFAULT']['User'], 'PASSWORD': conf['DEFAULT']['Password'], }, 'default': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': conf['DEFAULT']['Host'], 'PORT': conf['DEFAULT']['Port'], 'NAME': conf['DEFAULT']['Name'], 'OPTIONS':{ 'options': '-c search_path=django' }, 'USER': conf['DEFAULT']['User'], 'PASSWORD': conf['DEFAULT']['Password'], }, } Okay so that's the DB connection. β¦ -
Why pass self when calling a method on django model?
Why do we HAVE to pass self when creating a method within the model? If this is an instance of the class why can not the instance of the class pass the "self" in the background if it requires it. It just seem so repetitive to have to use the word 'self'. See code below. For example the correct way to do it is: def __str__(self): return "{} by {}".format(self.title, self.list_authors()) Why not omit the self and do the following and what happens if you do omit the self word? def __str__(): return "{} by {}".format(title, list_authors()) class Book(models.Model): title = models.CharField(max_length = 150) authors = models.ManyToManyField("Author", related_name="books") review= models.TextField(blank=True, null=True) date_reviewed = models.DateField(blank=True, null=True) is_favourite = models.BooleanField(default = False, verbose_name="Favourite?", help_text = "Favorite books?") def __str__(self): return "{} by {}".format(self.title, self.list_authors()) def list_authors(self): return ", ".join([author.name for author in self.authors.all()]) def save(self, *args, **kwargs): if(self.review and self.date_reviewed is None): self.date_reviewed = now() super(Book, self).save(*args, **kwargs) super(self, *args, **kwargs ) -
Django join on non-foreign key
In the real estate mysql DB I have the table 'flats' with several fields, one of them is 'address'. Other table ('address_info') stores certain information about buildings based on their addresses - particularly, the year of construction. Certain address might exist in 'flats' table but do not exist in 'address_info' - it happens when there is no information about the building. Due to this reason I can not create foreign key from flats.address to address_info.address. In Django app I have corresponding models: Flat and AddressInfo. How can filter Flats by their years of construction - i.e. perform the following query using QuerySet? SELECT * FROM flats f JOIN address_info ai ON a.address=ai.address WHERE ai.year_of_construction > 2010. Or can I create kinda "partial" foreign key in mysql that supports cases when the referenced key from parent table does not exist? Thanks :) -
With uwsgi deployed Django, part css and js can get, others can not
urls.py urlpatterns = [ ] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS) settings.py STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR,'static'), ) For example, /static/picture/8.jpg can getοΌbut /static/picture/9.jpgcan not. So i mv 9.jpg 8.jpg and the this picture(now is 8.jpg) still can not getοΌ How can i solve thisοΌ -
Is Django 1.8 compatible with Mongoengine 0.11.0?
I am trying to mongoengine 0.11.0 with Django 1.8. Is it compatiable? -
Disable All Authentication Django
I have an API written in Django, with authentication with cookie and sessionid. Now I want to add a end-point public, with any kind of authentication, but I can't access the end-point. What I've done: URL: url(r'^api/public_end_point/?$', csrf_exempt(views.publicEndPoint.as_view()), name='public_end_point') Views: class publicEndPoint(APIView): @api_view(['POST']) @permission_classes([permissions.AllowAny,]) def post(self, request, *args, **kwargs): return Response({"success": True, "content": "Hello World!"}) Some Ideas about what am I missing here ? Thanks -
Django - Unable to log user in using Python social Auth in custom User model
I am using Python social auth to login user in my app. I have custom User model therefore i am using custom create_user pipeline. The problem is That even after the complete of pipeline my user is not logged in. There is no error shown. Setting.py AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'social.backends.facebook.FacebookOAuth2', 'social.backends.google.GoogleOAuth2', 'social.backends.twitter.TwitterOAuth', ) LOGIN_REDIRECT_URL = '/home' LOGOUT_REDIRECT_URL = '/index' SOCIAL_AUTH_PIPELINE = ( 'social_core.pipeline.social_auth.social_details', 'social_core.pipeline.social_auth.social_uid', 'social_core.pipeline.social_auth.auth_allowed', 'social_core.pipeline.social_auth.social_user', 'userlogin.auth_pipline.signup.create_user', 'social_core.pipeline.social_auth.associate_by_email', 'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', ) Custom Create user pipeline code from django.contrib.auth.models import User from django.contrib.auth import login from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth import get_user_model User = get_user_model() from django.contrib.auth.backends import ModelBackend from django.utils.crypto import get_random_string def create_user(strategy=None, backend=None, details=None, response=None, request=None, *args, **kwargs): provider = backend.name try: user = User.objects.get(email=details['email']) except ObjectDoesNotExist: user = User.objects.create_user(email=details['email'], name=details['fullname'], password=get_random_string(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789')) if provider == "facebook": user.fb_id = response["id"] user.age = response["age_range"]["min"] elif provider == "twitter": user.tw_id = response["id"] else: user.gp_id = response["id"] login(strategy.request, user) return {'user': user} models.py from django.db import models from .managers import UserManager from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import PermissionsMixin class User(AbstractBaseUser, PermissionsMixin): # https://docs.djangoproject.com/en/1.10/topics/auth/customizing/ # https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html#abstractbaseuser name = models.CharField(max_length=100, null=True) email = models.EmailField(unique=True) dob = models.DateField(null=True) is_active = models.BooleanField(default=True) date_joined = models.DateTimeField(null=True) is_superuser = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) β¦ -
Django Rest Framework Refusing To Accept MultiPart Form Data
I am trying to post data which has nested json, an image and other data. The json looks like this: { "id": , "venue": { "id": , "name": "", "city": "", "address": "", "rating": null, "point": null }, "name": "", "time": "", "event_pic": null, "description": "", "event_type": "Movie", "invite_only": , "free": , "age_restriction": , "ticket_price": , "user": } I am running into a problem where for some reason if I try to use multipart form to upload I get an error message like this: Request http://zacmwa.pythonanywhere.com/api/events/ (7417ms) 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Server: openresty/1.9.15.1 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Date: Tue, 14 Feb 2017 13:21:26 GMT 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Content-Type: application/json 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Transfer-Encoding: chunked 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Connection: keep-alive 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Vary: Accept 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: X-Frame-Options: SAMEORIGIN 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: Allow: GET, POST, OPTIONS 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: {"venue":["This field is required."]} 02-14 16:21:26.468 7133-7762/com.wyat.wyat D/OkHttp: <-- END HTTP (37-byte body) It says {"venue":["This field is required."]} and sends me a 400 Bad Request. When I sent from Postman I could not send in multipart form but when I used application/json header I was able to solve this.However when using application/json I β¦ -
Django uploading images to a form- ManagementForm data is missing or has been tampered with
I have a Django website, and on one of the pages, I am trying to upload some images using a form. When I click the 'Browse' button to select the file I want to upload, a dialog box opens, and I browse to the file and click OK. The name of the selected file is then displayed next to the 'Browse' button. However, when I then click the 'Submit' button to Submit the form (and upload the attached image to the database entry for this object), the console displays the following output: Exception thrown in try in if drawing_formset: u'drawings-0-id' (<class 'django.utils.datastructures.MultiValueDictKeyError'>) Exception thrown in try in if budget_formset: ManagementForm data is missing or has been tampered with (<class 'django.core.exceptions.ValidationError'>) This exception is being handled by the view that I'm using to attach the images to the form: def upload_budget_pdfs(request, project_id): project = Project.objects.get(id=project_id) print("Value of project in 'upload_budget_pdfs()': ", project) if request.method == 'POST': presentations = project.budget_versions.select_related('meeting').prefetch_related('budget_items', 'cci_items', 'presenters').filter(version_number__isnull=False).annotate(vn=F('version_number') * -1).order_by('presentation_date', 'created', '-vn') print("Value of presentations in 'upload_budget_pdfs()': ", presentations) drawing_formset = DrawingUploadFormset(request.POST, request.FILES, prefix="drawings", queryset=Drawing.objects.filter(budget__in=presentations).order_by('budget__presentation_date', 'budget__created')) if drawing_formset: print "Before", [b.id for b in project.budget_versions.all()] # Surround for loop with a try-catch to see what's going on... try: β¦ -
How to compare data in SQL
I have an application which is taking data from questionnaires users are completing on a website and inputting this into a SQL Lite database. I'm using Django and would like to display data of users who match closest by selecting similar answers. How could this be done? -
How to control which elements are showed in a Codenerix GenList?
I have a Codenerix application and I want to know how to control which members are included in a GenList view. Can someone help me? -
Selection and install of Django + Anaconda+ Postgres on AWS
I have an web app (=html front end) using Django, Anaconda+PostGres in local. I am migrating to AWS and wondering the easiest solutio for setup, given app is only from 9am to 7pm (instance stopped after), low traffic (only internal needs) but high compute process and some RESTApi through Django. DB size is < 10Go. Compute process needs 4Go RAM. Is it better to install on one instance AWS : Ubuntu, T2 Medium with Anaconda, PostGres, Django ? Or separate with amazon RDS with EC2 for Django/Anaconda. -
Django - save data to the logged in user's profile. Custom User Model
Creating new instances in custom user model django as the logged in user forms.py from django import forms from django.forms import ModelForm from . models import User class ProfileForm(ModelForm): def __init__(self, *args, **kwargs): super(ProfileForm, self).__init__(*args, **kwargs) class Meta: model = User fields = ['full_name'] def save(self, commit=True): instance = super(ProfileForm, self).save(commit=False) if commit: instance.save() return instance views.py from django.shortcuts import render from django.views.generic.edit import CreateView from . forms import ProfileForm from . models import User # Create your views here. class ProfileCreate(CreateView): model = User form_class = ProfileForm template_name="profile/profile_new.html" models.py from __future__ import unicode_literals from django.db import models from django.core.mail import send_mail from django.contrib.auth.models import PermissionsMixin from django.contrib.auth.base_user import AbstractBaseUser from django.utils.translation import ugettext_lazy as _ from .managers import UserManager class User(AbstractBaseUser, PermissionsMixin): username = models.CharField(_('username'),max_length=120, unique=True, blank=False) email = models.EmailField(_('email address'), unique=True) full_name = models.CharField(_('full name'), max_length=30, blank=True) date_joined = models.DateTimeField(_('date joined'), auto_now_add=True) is_active = models.BooleanField(_('active'), default=True) is_staff = models.BooleanField(_('staff'), default=False) objects = UserManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] the form i created is creating a new instance completely. i want to add the fullname to the logged in user in the second row as shown in the image. -
Django select row query
What's the Django equivalent of this PHP MySQL query: $m_name = 'test1234' $file_check_query = "SELECT * FROM file_repo INNER JOIN asset_metadata ON file_repo.filename = asset_metadata.material_id WHERE filename = '$m_name'"; I'm trying to get my head around model queries but i think I'm over thinking things. -
django makemigrations does not working
I want makemigrations game.characters INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_summernote', 'lucifer', 'users', 'posts', 'game', 'game.characters', ] when I command python lucifer/manage.py makemigrations users posts game game.characters python lucifer/manage.py migrate App 'game.characters' could not be found. Is it in INSTALLED_APPS? I can't understand why? here is my game.characters from django.db import models from django.conf import settings from game.quests.models import Quest class Character(models.Model): user = models.ForeignKey( settings.AUTH_USER_MODEL, ) nickname = models.CharField( max_length=8, ) level = models.IntegerField( default=1, ) JOB_CHOICE = ( ('killer', 'λμ΄νΈ'), ('gunshoter', 'μΌλ§μ μ¬'), ('monster', 'νλΌλ'), ) job = models.CharField( max_length=4, choices=JOB_CHOICE, null=True, blank=True, ) Tree βββ Makefile βββ README.md βββ lucifer β βββ db.sqlite3 β βββ game β β βββ __init__.py β β βββ characters β β βββ __init__.py β β βββ models β β βββ __init__.py β β βββ character.py β βββ lucifer β β βββ __init__.py β β βββ settings β β β βββ __init__.py β β β βββ development.py β β β βββ partials β β β β βββ __init__.py β β β β βββ base.py β β β β βββ database.py β β β β βββ static.py β β β β βββ summernote.py β β β βββ production.py β β βββ β¦