Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Display two python lists in template next to each other [duplicate]
This question already has an answer here: Iterating through two lists in Django templates 6 answers I have two python lists that I send to my template. first_list = ['choice1', 'choice2', 'choice1', 'choice3'] second_list = ['foo1', 'foo2', 'foo1', 'foo3'] I want to display these two lists value by value in the correct order next to each other like this: choice1 -- foo1 choice2 -- foo2 choice1 -- foo1 choice3 -- foo3 I can display on of the two lists like so <ul> {% for x in first_list %} <li>{{ x }}</li> {% endfor %} </ul> But I'm not sure how to display both lists next to each other in the correct order. -
__init__() got multiple values for argument trying to override forms.Form
I'm trying to override my form to show a select with my data, my problem is when I try to send the form I get this error init() got multiple values for argument. form.py class ChangeMemberForm(forms.Form): coordinator = forms.ModelChoiceField(queryset=None,label="Pesquisadores", widget=forms.Select(attrs={'class':'form-control'})) def __init__(self,ubc, *args,**kwargs): super(ChangeMemberForm, self).__init__(*args,**kwargs) ubc = Ubc.objects.get(id=ubc) self.fields['coordinator'].queryset = ubc.researchers.all() view.py def change_coordinator(request, pk): template_name = 'ubc/addmember.html' ubc = Ubc.objects.get(pk=pk) if request.method == "POST": form = ChangeMemberForm(request.POST, ubc=ubc.id) if form.is_valid(): print(form.cleaned_data) return redirect('accounts:account_detail', pk=request.user.id) form = ChangeMemberForm(ubc=ubc.id) context = { 'form': form, } return render(request, template_name, context) -
Displaying Analytics
I want to display some analytics of fields of models, how can I do it? So My models. class Strategy(models.Model): name = models.CharField(max_length=30, unique=True) analyst = models.ManyToManyField(User) Class Line(models.Model): strategy = models.ForeignKey(Strategy,on_delete=models.CASCADE) analyst = models.ForeignKey(User,on_delete=models.CASCADE) conviction = models.IntegerField() target = models.FloatField() So, Now I would like to display analysis like this: Table for Average target : Where Average target for a particular user and a particular Strategy is Sum of Targets of All Line objects with that User and Strategy / No. of such Line objects +-----------------+-----+-----+-----+-----+-----+ | User\Strategy | st1 | st2 | st3 | st4 | All | +-----------------+-----+-----+-----+-----+-----+ | an1 | 1 | 1 | 1 | 1 | 2 | | an2 | 1 | 1 | 1 | 1 | 3 | | an3 | 1 | 1 | 3 | 3 | 4 | | an3 | 1 | 1 | 3 | 3 | 4 | | All | 1 | 1 | 1 | 1 | 1 | +-----------------+-----+-----+-----+-----+-----+ -
Django : How can I ignore unchanged forms of my formset when saving
I have a formset of modelForm and I need to ignore form hat are not filled when submitting my form here is the modelForm : class associe(forms.ModelForm): #Associé Marocain. date_naissance=forms.DateField(initial=datetime.date.today,widget=forms.TextInput(attrs= { 'type':'date' }),required = False) associe_gerant= forms.CharField(initial="0",label='',widget=forms.RadioSelect(choices=ASSOCIE_GERANT,attrs={'oninput':'this.className = ""'}),required = False) tassocie=forms.ChoiceField(initial="Physique",choices = TYPE_ASSOCIE,widget=forms.Select(attrs={'onchange':'TypeAssocie(this)'}),required = False) nassocie=forms.ChoiceField(initial="Marocain",choices = NATIONALITE,widget=forms.Select(attrs={'onchange':'NationaliteAssocie(this)'}),required = False) tapport= forms.CharField(initial="0",label="type d'apport",widget=forms.RadioSelect(choices=APPORT,attrs={'onchange':'TypeApport(this)'}),required = False) montant_apport= forms.FloatField(initial="0",required = False) type_apport= forms.CharField(initial="0",max_length=100,required = False) valeur_estimatif= forms.FloatField(initial="0",required = False) date_naissance_etrange=forms.DateField(initial=datetime.date.today,widget=forms.TextInput(attrs= { 'type':'date' }),required = False) date_naissance_gerant_asso= forms.DateField(initial=datetime.date.today,widget=forms.TextInput(attrs= { 'type':'date' }),required = False) class Meta: model=PerP fields=('nom','prenom','civilite','nassocie','tassocie','cin','date_naissance','lieu_naissance','adresse','passeport','num_sejour','date_delivrance','lien_delivrance','denomination','siege','forme_juridique','capital','ville','num_rc','civilite_gerant_asso','representant_legal','date_naissance_gerant_asso','pass_cin','nationalite_gerant_asso','adresse_gerant_asso','nom_etrange','prenom_etrange','nationalite','date_naissance_etrange','adresse_etrange',) my formset : FormSet=formset_factory(associe,extra=7) in my views.py this is the method that submits the form : def saveToBase(request): associe=FormSet(request.POST) if associe.is_valid(): for a in associe: if a.is_valid() and a.has_changed(): a.save() return render(request,'societe/accueil.html') but I'm always getting has_changed == True when I print a.has_changed() value. after hours of search I know now that I should add initial to my form but I cant figure out how can I do so, especially when I'm working with formset and not a normal form. any help please, I've been really stucking here for hours. Thank You in Advance -
shared task pass argument via celery beat periodic task
I setup celery beat as celery -A proj beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler And I have a method as def get_data(name) and I setup tasks.py as @shared_task def get_data(name): views.get_data(name) And in Django admin in periodic task I selected get_data and passed Arguments: as ["test_name"] But I get an error celery.beat.SchedulingError: Couldn't apply scheduled task get_data: get_data() takes 0 positional arguments but 1 was given I also tried Keyword arguments: but doesn't work. If I don't pass any arguments in worker I get error TypeError: get_data() missing 1 required positional argument: 'name' How can I pass name=test_name as argument? -
Project Name not found in scrapyd integration with Django
i'm trying to start scrapyd from django The scrapyd code is like this unique_id = str(uuid4()) # create a unique ID. settings = { 'unique_id': unique_id, # unique ID for each record for DB 'USER_AGENT': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' } task = scrapyd.schedule('scrap_lowongan','josbid', settings=settings) However, i'm getting scrapyd_api.exceptions.ScrapydResponseError: spider 'josbid' not found My folder structure is something like this Bitalisy> Bitalisy Scraping> views.py (Schedule scrapyd from here) scrap_lowongan> (scrapy Project) scrap_lowongan> spider> jobsid.py settings.py pipelines.py scrapyd.conf scrapy.cfg Note that i'm using scrapyd.conf because i have two scrapy project. The scrapy.conf [scrapyd] http_port = 6801 Thank you -
Can't use ChoiceField in model
I read online that you have to use models.CharField for choice fields as it doesn't allow models.ChoiceField. However, when using this field in a form and saving it to my database, instead of one of the choices 'cello' showing, it will just show an integer like '2'. How can I overcome this in order to have words from choice field in my database when saved? example models.py class User(AbstractBaseUser): email = models.EmailField(max_length=255, unique=True) first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) instrument1 = models.CharField(max_length=255, choices=instrument_list, blank=True) level1 = models.CharField(max_length=255, choices=level_list, blank=True) forms.py class TeacherSignUpForm(RegisterForm): instrument1 = forms.ChoiceField(choices=instrument_list, widget=forms.Select(attrs={'class' : 'form-control'})) level1 = forms.ChoiceField(choices=level_list, widget=forms.Select(attrs={'class' : 'form-control'})) def save(self, commit=True): user = super(TeacherSignUpForm, self).save(commit=False) user.instrument1 = self.cleaned_data['instrument1'] user.level1 = self.cleaned_data['level1'] user.teacher = True if commit: user.save() return user -
How can I create django model which implement lesson in timetable?
I'm trying to create a timetable system for classroom in Django. I have an idea which I am still wondering that i will work or not. Here is the model represent each lesson in class; lesson 1(7:00 AM - 7:50), lesson 2(7:50 - 8:40), etc. class Lesson(models.Model): start = models.TimeField() end = models.TimeField() lesson = models.PositiveSmallIntegerField(choices=[(i, i) for i in range(1, 10)], primary_key=True) class Meta: verbose_name = 'lesson' ordering = ['lesson'] def __str__(self): return "{}".format(self.lesson) What I need here is creating 10 lessons starting from 7:00 am and lasting 50 minutes each. I'd love to here your precious advises. Thank you. -
BooleanWidget is not defined in django-filter
I tried to create boolean widget following django-filter documentation However, I got error name 'BooleanWidget' is not defined Does anyone know how I can solve this problem? or what is causing this problem? I also add filter part below. class ProjectFilter(django_filters.FilterSet): user=django_filters.CharFilter(lookup_expr="iexact") project=django_filters.CharFilter(lookup_expr="icontains") good=django_filters.BooleanFilter(widget=BooleanWidget()) final = django_filters.BooleanFilter(widget=BooleanWidget()) class Meta: model=html fields=['program','location','certificate'] -
How do we call a function each time an api end-point is called in django
In my Django server, there is an rest api through which we are saving the values in the database. If the name exists in the database then I update the value or else will create a new value and name. The code for the function is given below: def getIgnitionData(): name_list =[] value_list =[] cursor = connections['ignition'].cursor() cursor.execute('SELECT * FROM MDA_table') value = cursor.fetchall() cursor.execute('SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = \'MDA_table\'') name = cursor.fetchall() for i in name: name_list.append(str(i[0])) for row in value: for j in row: value_list.append(str(j)) cursor.close() print name_list print value #Here we will check to see if the variable exists. If so, update the value. If not, #then create a new variable. for k in range(0,len(name_list)): if (Ignition.objects.filter(name = name_list[k]).exists()): Ignition.objects.filter(name=name_list[k]).update(value = value_list[k]) else: Ignition.objects.create(name=name_list[k], value=value_list[k]) The view_api.py is as follows: class IgnitionViewSet(viewsets.ModelViewSet): """ API endpoint that allows to view variables from the ignition database. """ serializer_class = IgnitionSerializer #queryset = ignition.objects.all() permission_classes = [HasGroupPermission] required_groups = { 'GET': ['Admin', 'Facility', 'Operator'], 'PUT': [], 'POST': [], } ignition.getIgnitionData() # This is where we are calling the function def get_queryset(self): return Ignition.objects.all() The code works well when I run the get request for the first time from … -
can i handle csv file in django view ,i dont want to creat a model for csv file
i have a decision tree algorithm which trained itself by the data stored in a csv file,now i am using django to create a simple web program which receive test data from the web page and then django will process the input and redirect to the result web page which contains the result predicted by the algorithm; now i get stuck when i trying to read csv file in view.py: this is the project structure: enter image description here as the above picture show ,i put the mybtrain.csv(trainning data file i am trying to read) under 'mysite' then i write some code in view.py,as following: enter image description here the IDE just tell,cannot find the csv file,then i put the mybtrain under the determineSafety which is the only app i created,still doesn't work,so i just want to ask:does my way can work if i modify something or this just doesn't on the right track? -
AttributeError: module 'profiles_api.models' has no attribute 'validated_data' DJANGO REST FRAMEWORK
issue with my rest api serializer class couldn't figure out the issue here is my models.py file class UserProfiles(AbstractBaseUser,PermissionsMixin): email=models.EmailField(max_length=255,unique=True) name=models.CharField(max_length=255,blank=False) is_active=models.BooleanField(default=True) is_staff=models.BooleanField(default=False) objects=UserProfileManager() USERNAME_FIELD='email' REQUIRED_FIELDS=['name'] def get_full_name(self): return self.name def get_short_name(self): return self.name def __str__ (self): return self.email serializers.py class UserProfileSerializer(serializers.ModelSerializer): class Meta: model=models.UserProfiles fields=('id','email','name','password') extra_kargs={'password':{'write_only':True}} def create(self,validated_data): user=models.UserProfiles( email=models.validated_data['email'], name=models.validated_data['name'], ) password=set_password(validated_data['password']) user.save() return user views.py class UserProfleViewset(viewsets.ModelViewSet): serializer_class=serializers.UserProfileSerializer queryset=models.UserProfiles.objects.all() urls.py router=DefaultRouter() router.register('hello-view',views.Hello,base_name='hello-view') router.register('profile',views.UserProfleViewset) and when i tried to create the user with valid credentials i get this error any kind of help is appreciated thanks in advance -
How to split String to int and bytestring literal
I have the following string: str = "3, b'\\xf3\\xc71\\xe9\\xad_\\xce\\x8bI\\x1c\\x04Y\\xd5z\\xa2Q'" I need to split it in order to get two variables, an int and a bytestring like so: number = 3 bytestring = b'\\xf3\\xc71\\xe9\\xad_\\xce\\x8bI\\x1c\\x04Y\\xd5z\\xa2Q' What I tried doing: number, bytestring = [s for s in str.split(", ")] int_number = int(number) bytestring_in_bytes = bytestring.encode() This unfortunately didn't work for the bytestring and I ended up with something like this: bytesring_in_bytes = b"b'\\xf3\\xc71\\xe9\\xad_\\xce\\x8bI\\x1c\\x04Y\\xd5z\\xa2Q'" Any idea how to get the bytestring from the string? -
Django - avoid false records if you change the pk of a dynamic url
I am designing an app where students can rate their teachers through a survey. basically what the app does is it generates a dynamic url for each teacher, for example: Teacher Mike : mywebsite.com/teacher/1 Teacher Brian: mywebsite.com/teacher/2 The numbers correspond to the PK of each teacher. The student fills out the survey and when sending it, first validates in the database that the answers have not been sent previously (to avoid duplicates). In case the answer has already been saved before, a page is displayed where it says this. Everything works fine, but there is a problem if the user (student) performs a strange action. When the student rates for example the Teacher Mike : the url that is generated is mywebsite.com/teacher/rate/1 and shows a template that says that the answer is saved. The problem comes here: If the person at that time changed the number(pk) in the url, for example from 1 to 2, the app saves the teacher-1's answers in the teacher-2's record. I know it's strange behavior. But I'd like to find a way to solve this. The view for submitting the answers is this: def send(request, user_pk): if not request.user.is_authenticated: return HttpResponseRedirect('/accounts/login/') else: #first look for … -
Queryset vs list Django
I was reading the documentation on queryset and came across following lines. Slicing an unevaluated QuerySet usually returns another unevaluated QuerySet, but Django will execute the database query if you use the “step” parameter of slice syntax, and will return a list. What is the difference between QuerySet and List? Also what is unevaluated QuerySet -
Using json model field with django graphene
I'm working with graphql endpoint for my project. One of models has textfield which contains some json. If i reqeust list of my entities via graphql, I'm getting this json like a string. How to reach ability to use it in graphql as nested structure with ability of filtering, choosing some properties etc. class SysObjects(models.Model): id = models.BigAutoField(primary_key=True) user_id = models.BigIntegerField() type_id = models.PositiveIntegerField(blank=True, null=True) # status = models.ForeignKey('SysObjectsStatuses', models.DO_NOTHING, blank=True, null=True) title = models.CharField(max_length=255, blank=True, null=True) data = models.TextField(blank=True, null=True) #json string is here visible = models.IntegerField() date_actual = models.DateTimeField() date_update = models.DateTimeField(blank=True, null=True) date_add = models.DateTimeField(blank=True, null=True) orig = models.CharField(max_length=255, blank=True, null=True) is_color = models.PositiveIntegerField() class Meta: managed = False db_table = 'sys_objects' app_label = "default" def __str__(self): return self.title -
How to display 'auto_now_add' fields in django forms?
I wish to know how to display 'auto_now_add' fields (and as disabled fields) in django frontend forms. I attach some of relevant code: # models.py class ModelA(models.Model): name = models.CharField('Name', max_length=100) inserted = models.DateTimeField('Inserted ', auto_now_add=True) # forms.py class ProcessModelAForm(forms.ModelForm): class Meta: model = ModelA fields = '__all__' widgets = { "name": forms.TextInput({ "class": "form-control", "disabled": True, }), "inserted": forms.DateTimeInput({ "class": "form-control", "disabled": True, }), } # views.py def process_model_a(request, pk): instance_model_a = get_object_or_404(ModelA, id=pk) process_form = ProcessModelAForm(instance=instance_model_a) if request.method == 'POST': # ... return render(request, 'myapp/process_model_a.html', {'process_form ': process_form , 'instance':instance_model_a , } ) # process_model_a.html <form method="post" class="form-horizontal"> {% csrf_token %} {% for field in process_form %} <div class="form-group form-group-lg"> <label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{field.label}}</label> <div class="col-sm-6"> {{ field }} </div> <div class="col-sm-4"> {{ field.errors }} </div> </div> {% endfor %} <div class="form-group"> <div class="col-sm-10"> <button type="submit" class="btn btn-primary btn-lg center-block">Process</button> </div> </div> </form> The page "process_model_a.html" shows only "name" fields. How can I display also "inserted" field? Thanks. -
Publish written python program on a website
a total newbie here. I wrote a program in python to compare 2 files and extract the similarity in the output. I want to publish that program in a webpage that will be served in Windows Server 2012, I will probably be using IIS or Apache. The reason why I'm doing it on a server is because I'm working in a company and my boss wants me to allow everyone to use that program without having everyone RDP to the server. Now I know very basic and limited php and html, I made the sketch of the webpage there are just 3 buttons/functions, upload 1, upload 2, and run. According to my knowledge which there might be an easier way that I have not yet discover, those buttons have to be configured using php to pinpoint every button to work, this is the area where I completely have no idea. I was also wondering if it is possible to install pythonanywhere on apache that will be on the windows server itself and people can just execute my code any time they need it, but i dont know if it will work or not. The only advice that i got is … -
A List inside a list in django templates
How do you render a list of user who have a list of their own objects related with foreign-key in Models. When I render in html it brings all list of all users in all users, -
jQuery DataTable translation in a Django project
I'm working on a Django application using the jQuery DataTables plugin. I've overwritten the labels of my table, but since I want my website to support several languages, I'd like to translate those strings. For the rest of the JavaScript code, I've used the gettext function thanks to the JavaScript catalog https://docs.djangoproject.com/fr/2.0/topics/i18n/translation/#internationalization-in-javascript-code But I'd need some precisions for this to work: 1 - Is this way the good way to go, because I tried to use gettext on my first string like gettext("No entry"), the entry is generated in my .po file but it's not taken into account in the front. 2 - Can I use a function like ngettext to translate my text with parameters like _START_ and _END_ ? $(document).ready(function () { $('#dataTable').dataTable({ "oLanguage": { "sEmptyTable": "No entry", "sInfo": "Displaying entries from _START_ to _END_ (total _TOTAL_)", "sInfoFiltered": "(filtering on _MAX_ entries)", "sSearch": "Filter :", "sZeroRecords": "No entry found", "sLengthMenu": "Display _MENU_ entries" }, }); -
Django list Category wont work
i want to list all of my categorys in a django template but i only getting back nothing, any idea: category_list:html {% extends 'quickblog/base.html' %} {% load readmore %} {% block content %} {% for categories in categories %} <h1>{{ categories.titel }} {{ categories.post_set.count }}</h1> <p>{{ categories.description|readmore:15|linebreaksbr }}</p> {% endfor %} {% endblock %} "readmore" is only a templatefilter, please ignore it. urls.py url(r'^categories/$', TemplateView.as_view(template_name='quickblog/category_list.html'), name='categories'), models.py class Category(models.Model): title = EncryptedCharField(max_length=255, verbose_name="Title") description = EncryptedTextField(max_length=1000, null=True, blank=True) categorycover = fields.ImageField(upload_to='categorycovers/', blank=True, null=True, dependencies=[ FileDependency(processor=ImageProcessor( format='JPEG', scale={'max_width': 350, 'max_height': 350})) ]) categoryicon = fields.ImageField(upload_to='categoryicons/', blank=True, null=True, dependencies=[ FileDependency(processor=ImageProcessor( format='JPEG', scale={'max_width': 16, 'max_height': 16})) ]) class Meta: verbose_name = "Category" verbose_name_plural = "Categories" ordering = ['title'] def __str__(self): return self.title Thanks -
Issues running python manage.py makemigrations
I am following this tutorial: https://thinkster.io/tutorials/django-json-api/authentication Once I get up to the python manage.py makemigrations step then I begin having issues. This is the first time I am running the command and do not have an existing database. Here is my relevant code below: /Volumes/Macintosh_HD/Documents/conduitapp/conduit/conduit/apps/authentication/models.py import jwt from datetime import datetime, timedelta from django.conf import settings from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin ) from django.db import models class UserManager(BaseUserManager): def create_user(self, email, password): """ Create and return a `User` with an email and password. """ if email is None: raise TypeError('Users must have an email address.') if password is None: raise TypeError('Superusers must have a password.') user = self.model(email=self.normalize_email(email)) user.set_password(password) user.save() return user def create_superuser(self, email, password): """ Create and return a `User` with superuser (admin) permissions. """ if email is None: raise TypeError('Users must have an email address.') if password is None: raise TypeError('Superusers must have a password.') user = self.create_user(email, password) user.is_superuser = True user.is_staff = True user.save() return user class User(AbstractBaseUser, PermissionsMixin): email = models.EmailField(db_index=True, unique=True) # Allows user to deactivate their account when they no longer want # to continue using our service is_active = models.BooleanField(default=True) # The `is_staff` flag is expected by Django to … -
Centos nginx + django + gunicorn 403 forbidden
I have a centos server with nginx installed where i would to load a django app. After install python34, nginx, django and gunicorn i configure nginx.conf file like this: user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; index index.html index.htm; server { listen 80 default_server; listen [::]:80 default_server; server_name 54.17X.2XX.11X; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location /static/ { #alias /opt/cath/static/; alias /home/ec2-user/test/endpoint/website/static/; } location / { proxy_pass http://127.0.0.1:8000/site; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } well at this point, when i start gunicorn and nginx seervic for all the resource under /home/ec2-user/test/endpoint/website/static/ i receive the 403 forbidden access error. I try with: sudo chmod -R 777 <Path to static> also tried with sudo chown -R … -
Django Rest Framework validation in POST method of APIView
I'm new to DRF and trying to build a rest api, I need to make an api for task executions not just for CRUD, that's why I have override the POST method of APIView as: class DeploymentsList(APIView): queryset = DeploymentOnUserModel.objects.all() def post(self, request): print(request.data) DeploymentOnUserModel.objects.create( deployment_name=request.data['deployment_name'], credentials=request.data['credentials'], project_name=request.data['project_name'], project_id=request.data['project_id'], cluster_name=request.data['cluster_name'], zone_region=request.data['zone_region'], services=request.data['services'], configuration=request.data['configuration'], routing=request.data['routing'], ) return Response(request.data) But I don't know how can I validate the request? when I'm overriding the APIView's POST method. -
Django AUTHENTICATION AND AUTHORIZATION groups and permissions want to create verified users
Hi Djangonauts, I am new to Django please forgive any silly mistake in logic or code. Intro: I am building a web app in which members can write posts on a topic and offer courses on that topic. Example A member can write a blog about doing a wheelie on a bicycle and offer courses on that. What I want: I want members who want to offer courses to be verified. Example: The member has to fill a form with their details like... name, address, and photo ID. Plus pay a charge of $9.99 to get verified. After admin (I in this case) checks if everything is good I will approve them. and then they will be "Verified Members" and be able to offer courses What I have so far: Right now members can offer courses as there is no verified clause class Event(models.Model): user = models.ForeignKey(User, related_name='seller') post = models.ForeignKey(Post, related_name='course') price = models.DecimalField(max_digits=6, decimal_places=2) stock = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(35)]) date = models.DateField() time_from = models.TimeField() time_to = models.TimeField() event_types = ( ('1', 'Webinar'), ('2', 'Actual Meet'), ) event_choice = models.CharField(max_length=1, choices=event_types) def get_absolute_url(self): return reverse('posts:single', kwargs={'username': self.user.username, 'slug': self.post.slug}) def __str__(self): return 'Meet for ' + self.post.title How I …