Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
What fields can you call with request.user in Django?
Sorry for the dumb question but I can't figure it out. I have a class based view for a form. I like to make some changes if the request.user is equal with something. I used before in some other views request.user.profile.leader that gives me a boolean answer. Thats OK. Now in this class based view I like to use a very similar stuff but with another model like this: request.user.trust.group but it gives me nothing. What am I doing wrong? -
I'm unable to send emails from Django App on AWS
I'm unable to receive emails from my app after deploying to Aws, My app sits on Ec2 and I host my env on Elastic Bean, The emailing situation works fine locally but not on AWS. Note: I use Amazon SES I'm not sure on what to do next at this point, I don't seem to be able to find the problem. -
Using languages other than English for username in Django
I am working on a project a Django project in which a user may use local languages for their username. So in place of ISCIIUsernameValidator I used UnicodeUsernameValidator to solve this problem. But here I faced a problem. While testing I used three two languages Hindi and Japanese for username. Japanese: I used Katakana(アーロン), Hiragana(まつもと) and Kanji(田中) for the username and it worked. Nice Hindi: When I used simple words like 'कलम' it worked. But when I used complicated words like 'मोहित' or 'लेखक', it failed. And the error I received was Enter a valid username. This value may contain only letters, numbers, and @/./+/-/_ characters. This is the Account class from the models.py class Account(AbstractBaseUser, PermissionsMixin): username_validator = UnicodeUsernameValidator() username = models.CharField( _('username'), max_length=25, unique=True, validators=[username_validator], error_messages={ 'unique': _("A user with that username already exists."), }, ) email = models.EmailField(_('email address'), max_length=30, unique=True) date_joined = models.DateTimeField(_('date joined'), auto_now_add=True) last_login = models.DateTimeField(_('last login'), auto_now=True) ref_code = models.CharField(_('Ref Code Used'), max_length=20, blank=True, null=True) is_active = models.BooleanField(_('active'), default=False, is_staff = models.BooleanField(_('staff status'), default=False) is_admin = models.BooleanField(_('admin status'), default=False) is_superuser = models.BooleanField(_('superuser status'), default=False) objects = AccountManager() EMAIL_FIELD = 'email' USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['email'] class Meta: verbose_name = _('Account') verbose_name_plural = … -
I've created objects in the admin page of my app, but I'm unable to call the object in my html template. I will put the views and the html lines below
from django.shortcuts import render, redirect from .models import * from .forms import * def index(request): tasks = Task.objects.all() form = TaskForm() if request.method == 'POST': form = TaskForm(request.POST) if form.is_valid(): form.save() return redirect('/') context = {'tasks': tasks, 'form': form} return render(request, 'todo_app/list.html') {% for task in tasks %} <div class="task-container"> <p>{{task}}</p> </div> {% endfor %} -
cannot use admin.modeladmin subclass
I've started django for 2 days and i get stuck in this section. i want change admin section but my class couldnt inherit from admin.modeladmin. when i want use list_display ,nothing load and python give me this error: <class 'django.contrib.auth.admin.GroupAdmin'>: (admin.E108) The value of 'list_display[0]' refers to 'title', which is not a callable, an attribute of 'GroupAdmin', or an attribute or method on 'auth.Group'. <class 'django.contrib.auth.admin.GroupAdmin'>: (admin.E108) The value of 'list_display[1]' refers to 'view', which is not a callable, an attribute of 'GroupAdmin', or an attribute or method on 'auth.Group'. from django.contrib import admin from .models import articles class articlesAdmin(admin.ModelAdmin): list_display=("title","view") admin.site.register(articles) -
Django docker migrations not working after renaming model
I have a Django Docker setup using postgresql in RDS. I managed to run the project successfully once and edited some model names. After that I built and launched a new container. I noticed that instead of getting the typical: "We have detected changes in your database. Did you renamed XXX to YYY?" I got all my models migrating for the first time and everything seemed to work until I got to the Django admin. ProgrammingError at /admin/upload/earnings/ relation "upload_earnings" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "upload_earnings" This is my Dockerfile. version: '3.8' services: web: build: context: ./app dockerfile: Dockerfile.prod command: gunicorn hello_django.wsgi:application --bind 0.0.0.0:8000 volumes: - static_volume:/home/app/web/staticfiles - media_volume:/home/app/web/mediafiles expose: - 8000 env_file: - ./.env.prod nginx-proxy: container_name: nginx-proxy build: nginx restart: always ports: - 443:443 - 80:80 volumes: - static_volume:/home/app/web/staticfiles - media_volume:/home/app/web/mediafiles - certs:/etc/nginx/certs - html:/usr/share/nginx/html - vhost:/etc/nginx/vhost.d - /var/run/docker.sock:/tmp/docker.sock:ro depends_on: - web nginx-proxy-letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion env_file: - ./.env.prod.proxy-companion volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - certs:/etc/nginx/certs - html:/usr/share/nginx/html - vhost:/etc/nginx/vhost.d - acme:/etc/acme.sh depends_on: - nginx-proxy volumes: postgres_data: static_volume: media_volume: certs: html: vhost: acme: -
Django rest framework Serializer Save() problem
Hi there i am new ot django and django rest framework and i am having torouble when using serializers with PrimarayKeyTelatedFields() the code below is my code for my models.py from django.db import models class Author(models.Model): name = models.CharField(max_length=50) age = models.IntegerField(default=0) class Book(models.Model): name = models.CharField(max_length=40) author = models.ForeignKey(to=Author, on_delete=models.CASCADE) below is my serializer code from rest_framework import serializers from books.models import Book, Author class BookSerializer(serializers.ModelSerializer): author_id = serializers.PrimaryKeyRelatedField(many=False, queryset=Author.objects.all()) class Meta: model = Book fields = ['id', 'name', 'author_id'] class AuthorSerializer(serializers.ModelSerializer): class Meta: model = Author fields = ['id', 'name', 'age'] and when i try to execute following commands in shell >>from books.api.serializers import BookSerializer, AuthorSerializer >> play1 = BookSerializer(data = { 'author_id':1 ,'name':'book1' }) >>play1.is_valid() True >>play1.save() After executing above i got the huge error as i pasted below Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\models\fields\__init__.py", line 1988, in get_prep_value return int(value) TypeError: int() argument must be a string, a bytes-like object or a number, not 'Author' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\rest_framework\serializers.py", line 962, in create instance = ModelClass._default_manager.create(**validated_data) File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\models\query.py", line 514, in … -
How to send two response for a single post request in Django Rest Framework?
I am processing a video in backend but it's taking some time so I am looking for a way by which I can send the process time first and after it's completion I can send the video url. I tried using HttpResponse.write() but it didn't send the response. I got response only after the completion of whole process. -
PostgreSQL with Django failing to connect in Standar App Engine
I have a Django 4 app with PostgreSQL. I connected the SQL instance vie google-proxy correctly, however when I upload it into App Engine it fails to connect. settings.py if os.getenv('GAE_APPLICATION', None): # Running on production App Engine, so connect to Google Cloud SQL using # the unix socket at /cloudsql/<your-cloudsql-connection string> DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': '/cloudsql/instancename', 'USER': 'user', 'PASSWORD': '********', 'NAME': 'database', 'PORT': '5432', } } else: DATABASES = { 'default': { "ENGINE": "django.db.backends.postgresql", 'NAME': 'database', 'USER': 'user', 'PASSWORD': '******', 'HOST': '127.0.0.1', 'PORT': '5432', } } The error that on the screen was related with psycopg2: could not connect to server: Connection refused Is the server running locally and accepting connections on Unix domain socket "/cloudsql/instancename/.s.PGSQL.5432"? /layers/google.python.pip/pip/lib/python3.9/site-packages/psycopg2/__init__.py, line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) I updated the requirements.txt because locally with the proxy everything was correct. asgiref==3.5.0 Django==4.0 django_better_admin_arrayfield==1.4.2 djangorestframework==3.13.1 django-cors-headers==3.7.0 django-filter==2.4.0 django-ratelimit==3.0.1 gunicorn==20.1.0 django-cors-headers==3.7.0 psycopg2==2.8.6 psycopg2-binary==2.9.3 pytz==2020.4 sqlparse==0.4.1 google-api-core==1.26.0 google-api-python-client==1.12.8 google-auth==1.27.0 google-auth-httplib2==0.0.4 google-cloud-core==1.6.0 google-cloud-storage==1.36.1 google-crc32c==1.1.2 google-resumable-media==1.2.0 googleapis-common-protos==1.53.0 I also added all the APIs necessaries according to the google docs Lastly, I read the logs in App Engine and the first error is about IAM rpc error: code = PermissionDenied desc = IAM … -
Django custom field change not detected by migrations
I have multiple custom fields in Django. First, they extended PositiveSmallIntegerField as we used int choices like: class BusinessLegalFormField(models.PositiveSmallIntegerField): choices = [(1,'SRO'), (2, ....] def __init__(self, *args, **kwargs): if not args or not args[0]: kwargs.setdefault('verbose_name', 'Právna forma') kwargs['choices'] = self.choices super().__init__(*args, **kwargs) Then I changed it to CharField and TextChoices: class BusinessLegalFormField(models.CharField): class Choices(models.TextChoices): ZIVNOST = 'zivnost', 'Živnosť' SRO = 'sro', 'Spoločnosť s ručením obmedzeným' AS = 'as', 'Akciová spoločnosť' def __init__(self, *args, **kwargs): if not args or not args[0]: kwargs.setdefault('verbose_name', 'Právna forma') kwargs.setdefault('max_length', 64) kwargs['choices'] = self.Choices.choices super().__init__(*args, **kwargs) The problem is that I just realized that Django didn't detect the type change. When I change something like null=True to null=False it is detected, but the DB type is not changed from number to char. How can I make it work? -
Configure IFC.js with webpack
I am running a django application and I want to use frontend stack for which I need a bundler. I am new to bundlers, but I decided to go with webpack and I am trying to configure IFC.js (https://ifcjs.github.io/info/docs/Hello%20world), following the hello world tutorial but using webpack. Right now I am running into the error: Field 'browser' doesn't contain a valid alias configuration but I am also unsure about the general configuration of my webpack. My config-file: const path = require("path") module.exports = { mode: "development", entry: { app: "/src/index.ifc.js" }, watch: true, devtool: "source-map", output: { filename: "[name].bundle.js", path: path.resolve(__dirname, "dist") }, module: { rules: [ { test: /\.ifc.js$/, exclude: /node_modules/, } ] }, resolve: { extensions: [ ".ifc.js" ] } I think what this means is that all files with the suffix .ifc.js will be compiled when running webpack. I can get it to work using a simple alert statement in the index.ifc.js file. It compiles it to the dist-directory and the JS-code executes. But when I copy the code from the hello-world tutorial I get: Field 'browser' doesn't contain a valid alias configuration /Users/myuser/projectfolder/myproject/myapp/static/node_modules/web-ifc-three/IFCLoader doesn't exist The code I am using copied from the tutorial: import { … -
Django how to Post Form to an Api [closed]
I need the user to fill a form with their information so that I can make a call to an external Api for customer compliance verification. Below is the example request import requests url = "https://spxon.getid.dev//api/v1/application/:id" payload={} headers = {} response = requests.request("GET", url, headers=headers, data=payload) print(response.text) How can I get user input for the form and pass into payload {} ? Thanks in advance -
Data don't automatically updated that I uploaded from django admin
In development , I uploaded some data from django admin to a table. But when I refresh a page that uses that table then the new added data don't appears . It appears only when i rerun the manage.py runserver command. How can i fix this? I am expecting that the new data from the table should appear after added through django-admin. -
Get a value before submitting a form in Django
class StudentRegistrationForm(forms.Form): end_year = forms.IntegerField(widget = forms.TextInput( attrs={ 'id': 'end-year' } )) grade_letter = forms.ChoiceField( choices= get_grades(get_year()) ) To get the list of grade_letters for choice I need to know the end_year value. How can I get the value of end_year field before the submit (when the user wants to choose grade_letter)? -
I am getting error Expecting value: line 1 column 1 (char 0) when trying to DeSerialization and Insert Data Django REST Framework
I am getting error Expecting value: line 1 column 1 (char 0) when trying to DeSerialization and Insert Data Django REST Framework. Models.py from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models # Create your models here. class Products(models.Model): name = models.CharField(max_length=255) price = models.DecimalField(max_digits=10, decimal_places=2) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now_add=True) rating = models.FloatField(validators=[MinValueValidator(0.0), MaxValueValidator(10.0)]) image = models.FileField(default="") total_participant = models.IntegerField() participant_price = models.DecimalField(max_digits=10, decimal_places=2) is_delete = models.BooleanField(default=False) I am getting error Expecting value: line 1 column 1 (char 0) when trying to DeSerialization and Insert Data Django REST Framework. Serializer file serializers.py from rest_framework import serializers from .models import * class ProductsSerializer(serializers.Serializer): name = models.CharField(max_length=255) price = models.DecimalField(max_digits=10, decimal_places=2) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now_add=True) rating = models.FloatField(validators=[MinValueValidator(0.0), MaxValueValidator(10.0)]) image = models.FileField(default="") total_participant = models.IntegerField() participant_price = models.DecimalField(max_digits=10, decimal_places=2) is_delete = models.BooleanField(default=False) def create(self, validate_data): return Products.objects.create(**validate_data) I am getting error Expecting value: line 1 column 1 (char 0) when trying to DeSerialization and Insert Data Django REST Framework. simple python app where i insert the data myapp.py import requests import json UrL= "http://127.0.0.1:8000/pcreate/" data = { 'name' : 'Umer', 'price': '3000', 'created_at' : 'True', 'updated_at' : 'True', 'rating' : '3.4', 'image' : '', 'total_participant' : '4', 'participant_price' … -
navbar dosenot come up and it under the content
i have a proplem with my navbar the content comes up on my navbar so can any one help me to fix it i useing django include to get the navbar so can any one help me plese the image some text pec there a err while post the q some text pec there a err while post the q some text pec there a err while post the q some text pec there a err while post the q ................................................. this is my code {% block content %} <!DOCTYPE html> <!-- Created By CodingNepal - www.codingnepalweb.com --> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <script src="https://kit.fontawesome.com/a076d05399.js"></script> </head> {% if user.is_authenticated %} <div class="wrapper"> <nav> <input type="checkbox" id="show-search"> <input type="checkbox" id="show-menu"> <label for="show-menu" class="menu-icon"><i class="fas fa-bars"></i></label> <div class="content"> <li class="logo"><a class="alog" href="#">Website</a></li> <ul class="links"> <li><a href="{% url 'frontpage' %}">Home</a></li> <li><a href="{% url 'lunchers' %}">lunchers</a></li> <li><a href="{% url 'resourepacks' %}">resourepacks</a></li> <li><a href="{% url 'aboutus' %}">aboutus</a></li> <li> <a href="#" class="desktop-link">More</a> <input type="checkbox" id="show-services"> <label for="show-services">More</label> <ul> <li><a href="{% url 'add_post' %}">Create Post</a></li> <li><a href="#">Drop Menu 2</a></li> <li><a href="#">Drop Menu 3</a></li> </li> </div> <a style="padding-top: -50px;" class="aimpro" href="{% url 'profile' user.profile.id %}"><img style="padding-top: -10px;" src="{{ user.profile.avatar.url }}" alt="Avatar" class="avatar"></a> <label … -
gdstorage config is throwing error; Django
MySettings from decouple import config GOOGLE_DRIVE_STORAGE_JSON_KEY_FILE = config("GOOGLE_DRIVE_STORAGE_JSON_KEY_FILE_CONTENTS") I'm trying to setup gdstorage for my django project but was not given a json file according to the instruction in the docs so i copied the keys and placed it in my environmental variable yet it's still throwing this error. MyErrorMessage gd_storage = GoogleDriveStorage() File "C:\Users\username\.virtualenvs\vicsite-3EqYD9rF\lib\site-packages\gdstorage\storage.py", line 160, in __init__ credentials = Credentials.from_service_account_file( File "C:\Users\username.virtualenvs\vicsite-3EqYD9rF\lib\site-packages\google\oauth2\service_account.py", line 238, in from_service_account_file info, signer = _service_account_info.from_filename( File "C:\Users\username.virtualenvs\vicsite-3EqYD9rF\lib\site-packages\google\auth\_service_account_info.py", line 72, in from_filename with io.open(filename, "r", encoding="utf-8") as json_file: FileNotFoundError: [Errno 2] No such file or directory: '78a23bb0124ac97ec7404104ae37dccffe33846a' -
how to add a map to admin page django
i want to get coordinates using map on admin page(latitude and longitude) i added in models field from django.contrib.gis.db import models as gis point = gis.PointField(null=True, blank=True, srid=4326, verbose_name='location') but i'm getting an error django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.2.0", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings. I realized that I need to add GDAL_LIBRARY_PATH to settings, but I don't know what to put there or if there is another way to add a map to the admin page? -
django https for another host except localhost
I'm trying to install SSL certificate for local server. I found this tutorial and try to do step by step. Everything is working fine for 127.0.0.1:8000, but not for my another host. settings.py ALLOWED_HOSTS = ['127.0.0.1', '192.168.4.241'] What I tried: mkcert -cert-file cert.pem -key-file key.pem localhost 127.0.0.1 192.168.4.241 python manage.py runserver_plus 192.168.4.241:8000 --cert-file cert.pem --key-file key.pem Error: OSError: [WinError 10049] The requested address is not valid in its context How can I fix this? -
Inherinting Django SetUpTestData method called for each child
Inheriting a mother class make its classmethod setUpTestData called for each child class. This is what I excepted but not what I want. Here is a minimalist example from django.test import TestCase class ParentClass(TestCase): @classmethod def setUpTestData(cls): cls.parent_attr = "parent value" print("ParentClass.setUpTestData called") # this is called twice class TestChild1(ParentClass): @classmethod def setUpTestData(cls): super(TestChild1, cls).setUpTestData() cls.child_attr = "child value 1" def test_child(self): self.assertEqual(self.parent_attr, "parent value") self.assertEqual(self.child_attr, "child value 1") class TestChild2(ParentClass): @classmethod def setUpTestData(cls): super(TestChild2, cls).setUpTestData() cls.child_attr = "child value 2" def test_child(self): self.assertEqual(self.parent_attr, "parent value") self.assertEqual(self.child_attr, "child value 2") $ python manage.py test accounts.tests.test_test Creating test database for alias 'default'... System check identified no issues (0 silenced). ParentClass.setUpTestData called .ParentClass.setUpTestData called . ---------------------------------------------------------------------- Ran 2 tests in 0.006s OK Destroying test database for alias 'default'... I want to be able to make many child class where each child class would apply tiny modification to the common 'inherited' database. However I do not want to run many time the parent classmethod as it is very slow. How can I ensure parent database is generated only once and that every child class works on a copy of parent database instead of regenerating the entire database. -
Django how to print datetimefield with timezone
I'm trying to print my datetime fields with the time zone i.e like this 2022-03-28T00:00:00+05:30 My serializer like this class ChallengeReadSerializer(serializers.ModelSerializer): start_date = serializers.DateTimeField(format='iso-8601') class Meta: model = models.Challenge fields = [ "start_date", ] Prints this 2022-03-23T03:16:00Z When I modify the serializer like this class ChallengeReadSerializer(serializers.ModelSerializer): start_date = serializers.SerializerMethodField() class Meta: model = models.Challenge fields = [ "start_date", ] def get_start_date(self, obj): return obj.start_date.isoformat() It prints 2022-03-28T00:00:00+05:30, which is what I want. I don't understand how this is happening, and couldn't find any information except it being two formats, how does the .isoformat() print timezone and (format='iso-8601') not print TZ -
django pwa not working for another hosts except localhost
I have install django-pwa and everything is working fine on localhost (127.0.0.1). But I can't see a install app button on the other host. How can I fix that? settings.py ALLOWED_HOSTS = ['127.0.0.1', '192.168.4.241'] PWA_APP_NAME = 'QLNB' PWA_APP_DESCRIPTION = 'QLNB' PWA_APP_THEME_COLOR = '#016e38' PWA_APP_BACKGROUND_COLOR = '#f0ece2' PWA_APP_START_URL = '/' PWA_APP_DEBUG_MODE = False PWA_APP_ICONS = [ { 'src': '/static/images/TDF.png', 'sizes': '160x160' } ] PWA_SERVICE_WORKER_PATH = BASE_DIR / 'static/scripts/serviceworker.js' base.html {% load static %} {% load pwa %} <!doctype html> <html lang="cs" class="w-100 h-100 m-0 p-0 overflow-auto"> <head> {% progressive_web_app_meta %} -
Django Templates check if string is "\t"
I am extending a selection form for csv delimiters and wanted to add the option for the tab character. <option value="&#9;" {% if settings.csvImportDelimiter == '&#9;' %} selected {% endif %}>Tab</option> The part that is not working is {% if settings.csvImportDelimiter == '&#9;' %}. I tried putting '\t' instead of ' ' without success. Is there a different syntax to this? I looked at the both Jinja and Django template docs but did not find anything on these control symbols. -
Django cache isolation when running tests in parallel
When I run tests in parallel, I get random failures because one test interferes with the cache of another test. I can work around the problem with @override_settings( CACHES={ "default": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache", "LOCATION": "[random_string]", } }, ) Actually to make that smaller I created a @isolate_cache decorator that is a wrapper around override_settings. But still I need to go and decorate a large number of test cases. This is error prone, because, as I said, the failures are random. I might run the test suite 100 times without error and think that everything is OK, but I still might have forgotten to decorate a test case, and at some point it will fail randomly. I've also thought about creating my own TestCase subclass and use only that for all my test cases. This presents a similar problem: at some point someone would inherit from django.test.TestCase out of habit, and it might not fail for a long time. Besides, some of my tests inherit from rest_framework.test.APITestCase (or other classes), so there isn't a single test case subclass. Is there any way to tell Django to run each test case in an isolated section of the cache once and for all? -
Django: How to create some variable in model based on the foreign key data?
I am new to Django and right now I am working on my first project: sits reservation system for some cinema. For this I have created 3 models: Movie, Hall and Event. Hall generates sits map as array. class Hall(models.Model): HALL_NAME = ( ('A', 'Hall A'), ('B', 'Hall B'), ('C', 'Hall C') ) hall_name = models.CharField(choices=HALL_NAME, max_length=30) hall_structure = models.CharField(max_length=10000, default=generate_sits(hall_name)) @property def get_sits(self): if self.hall_name == 'A': return generate_sits('A') if self.hall_name == 'Hall B': return generate_sits('B') if self.hall_name == 'Hall C': return generate_sits('C') else: return "lol" def __str__(self): return f'{self.hall_name}' After that i would like to create a variable for Event model, which takes the array structure of the sits, turns it into dictionary (Example ['A1': 'empty', 'A2': 'empty', ...] ). I want this variable to be overwritten in the future, when someone should book a sit on the vebsite (['A1': 'reserved']). Here is my Event model: class Event(models.Model): EVENT_DAYS = ( ('mon', 'Monday'), ('tu', 'Tuesday'), ('we', 'Wednesday'), ('th', 'Thursday'), ('fr', 'Friday'), ) EVENT_TIME_SLOT = ( ('10', '10:00'), ('13', '13:30'), ('17', '17:00'), ('20', '20:30'), ('00', '00:00'), ) EVENT_TYPE = ( ('2d', '2D'), ('3d', '3D'), ) end_default = "for this Event was assigned yet" days_default = "No day " time_default …