Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Form Select From another model without Foreign Key
I want to make th_wali get value from another mode. In User_Admin model there is no 'th_wali' class InsertUser(forms.ModelForm): class Meta(): model = User_Admin fields = '__all__' labels ={ 'username': 'Username', 'password': 'Password', 'role' : 'Role', 'th_wali' : 'Tahun Wali', } widgets = { 'username':forms.TextInput( attrs={ 'class':'form-control', 'placeholder':'username', 'required' : True, 'minlength' : 8, } ), 'th_wali':forms.ModelChoiceField(queryset=Mhs_SI.objects.values('th_masuk').distinct()), } I call in template like this, but doesn't show up <div class="form-group row"> <label class="control-label col-md-3 col-sm-3 ">{{formUser.th_wali.label_tag}}</label> <div class="col-md-9 col-sm-9 "> {{formUser.th_wali}} </div> </div> -
rdb vs key-value store for django functionality
Going through the django documentation, this sentence on mixins states: "In practice you’d probably want to record the interest in a key-value store rather than in a relational database..." Why? Why would one want to record the interest in a key-value store, as opposed to in my postgres db I already have for my django app? Does it affect performance? -
Filtering dropdown queryset based on URL parameter
I am building a CRM where I want each client to have multiple plans, and each plan to have multiple notes. When a user creates a new note, I want them to be able to select a relevant plan from a dropdown of plans belonging to the client. From what I can find, I should be able to get the contact_id from the kwargs, but my errors show nothing in kwargs. I know there should be a way to do this, but I can't seem to find it. Variable Value __class__ <class 'lynx.forms.SipNoteForm'> args () kwargs {} self <SipNoteForm bound=False, valid=Unknown, fields=(sip_plan;note;note_date;fiscal_year;quarter;class_hours;instructor;clients)> Views.py @login_required def add_sip_note(request, contact_id): form = SipNoteForm() if request.method == 'POST': form = SipNoteForm(request.POST) if form.is_valid(): form = form.save(commit=False) form.contact_id = contact_id form.user_id = request.user.id form.save() return HttpResponseRedirect(reverse('lynx:client', args=(contact_id,))) return render(request, 'lynx/add_sip_note.html', {'form': form}) Forms.py class SipNoteForm(forms.ModelForm): class Meta: model = SipNote exclude = ('created', 'modified', 'user', 'contact') def __init__(self, *args, **kwargs): super(SipNoteForm, self).__init__(*args, **kwargs) self.fields['sip_plan'].queryset = SipPlan.objects.filter(contact_id=kwargs.get("contact_id")) Urls.py path('add-sip-note/<int:contact_id>/', views.add_sip_note, name='add_sip_note'), -
Wagtail profile avatar into ImageRenditionField serializer
I want to serialize the profile avatar from Wagtail admin with ImageRenditionField. Basing on the answer from the question I tried this: # models.py class User(AbstractUser): def get_avatar(self): return self.wagtail_userprofile.avatar # serializers.py class PersonSerializer(serializers.ModelSerializer): avatar = ImageRenditionField('width-190', source='get_avatar') class Meta: model = User fields = ['id', 'username', 'first_name', 'last_name', 'avatar'] I got this: Django Version: 3.1.4 Exception Type: AttributeError Exception Value: 'ImageFieldFile' object has no attribute 'get_rendition' How do I throw user avatar into ImageRenditionField? -
Django formset.is_valid() returns False, creates additional forms (even with extra=0)
I have 2 formsets (RefLocFormSet and RefNoteFormSet), and one other form (ref_form) that I am displaying within one HTML element. The ref_form is split into 2 tabs, and the other 2 tabs on the page contain one formset each. If I make changes to the notes field in the first form in the RefLocFormSet shown below (i.e. by changing "Lethbridge and surrounding area" to some other text) and then press SAVE CHANGES, formset.is_valid() returns False. The cleaned_data for each form in the formset (which is set up to print in views.py when .is_valid() returns False), appears as follows: {'location_01': <location_01: Canada>, 'location_02': <location_02: Alberta (Province)>, 'ref_loc_note': 'Lethbridge and surrounding area, test', 'id': <location_join: Canada:Alberta (Province) (LastName2011: Title here)>} {'location_01': <location_01: Canada>, 'location_02': <location_02: Ontario (Province)>, 'ref_loc_note': 'GTA', 'id': <location_join: Canada:Ontario (Province) (LastName2011: Title here)>} {'location_01': None, 'location_02': None, 'ref_loc_note': ''} {'location_01': None, 'location_02': None, 'ref_loc_note': ''} [{}, {}, {'id': ['Select a valid choice. That choice is not one of the available choices.']}, {'id': ['Select a valid choice. That choice is not one of the available choices.']}] Although there should be only 2 forms in the formset, it appears that there are 4. Any ideas on how to stop these extra … -
Django / uwsgi / Docker Configuration
I have a working implementation of a Nginx, Uwsgi, and Django application running on a local server. I am trying to recreate the application minus the Nginx portion inside of a docker container, so that I can easily port it to a system like AWS. I am getting the following error message with the following configuration files. unable to load configuration from www-data I believe that this is due to a permissions error, as when I remove the --gid www-data flag, the process starts, but running in root mode, which curses the process. I have tried the following commands to no avail, with repo being the project folder. chown -R myuser:www-data Repo/ chmod -R 744 Repo/ Dockerfile FROM python:3.8 FROM node:12 RUN apt-get update && \ apt-get upgrade -y && \ apt-get clean -y && \ apt-get install -y --no-install-recommends apt-utils tar git build-essential python3 python3-pip python3-setuptools python3-dev net-tools RUN mkdir /var/log/uwsgi /shared COPY . /app WORKDIR /app RUN pip3 install --upgrade pip virtualenv RUN virtualenv venv RUN /bin/bash -c "source venv/bin/activate" RUN pip3 install --no-cache-dir -r requirements.txt RUN npm install --prefix frontend RUN npm run build --prefix frontend RUN ln -sf /dev/stdout /var/log/uwsgi/djangoapp.log && ln -sf /dev/stdout /var/log/uwsgi/emperor.log VOLUME … -
user can't create articles
from django.shortcuts import render,HttpResponse,redirect from . import models,forms from django.contrib.auth.decorators import login_required def articles_list(request): articles=models.Article.objects.all().order_by('-date') return render(request,'articles/articleslist.html',{'articles':articles}) def articles_detail(request,slug): # return HttpResponse(slug) article = models.Article.objects.get(slug=slug) return render(request,'articles/article_detail.html',{'article':article}) @login_required(login_url = "/userAccounts/login") def create_article(request): if request.method=='POST': form = forms.CreateArticle(request.POST,request.FILES) if form.is_valid: instance = form.save( commit = False) instance.author = request.user instance.save() return redirect('articles:list') else: form = forms.CreateArticle() return render(request,'articles/create_article.html',{'form':form}) -
Use function both as view and as a celery task
I use Django 2.2.12 and Celery 4.4.7 I have some functions (e.g.: downloadpictures) that need to be both used as a view and as a scheduled recurring task. What is the best way to set it up ? Below code generates the following error message : NameError: name 'downloadpictures' is not defined downloadapp/views.py def downloadpictures(request=None): xxx xxx downloadapp/tasks.py from downloadapp import downloadpictures @shared_task def downloadpicturesregular(): downloadpictures() celery_tasks.py app.conf.beat_schedule = { 'downloadpictures_regular': { 'task': 'downloadapp.tasks.downloadpicturesregular', 'schedule': crontab(hour=18, minute=40, day_of_week='thu,sun'), }, }, -
How to format current time in django views?
I'm unable to figure out that how to format present time in django views. I just want to show year-month-date .Can you guys tell me how to do this ? Right now i'm trying in a following way. from django.utils import timezone print('date :',timezone.now()) and it returns : date : 2020-12-31 18:34:29.309006+00:00 Desire output is : date : 2020-12-31 -
insert not working ,it redirect to view without saving the data
def insert_(request): if request.method=='GET': form=ClientServicesForm() return render(request,"ClientServices/insert.html",{'form':form}) else: form=ClientServicesForm(request.POST) if form.is_valid(): form.save() return redirect('/clientservices/') I am trying to save data from a form but it is not saving to database ,it is rendering insert.html peroperly ,while saving it does not save database but without saving redirect to view -
BootstrapError: Parameter "form" should contain a valid Django Form
I keep getting the above error (in the title) for my DeleteView. Strangely my UpdateView, UpdateObject form and update_object template are identical to my DeleteView, DeleteObject form and delete_object template respectively. I'm not sure why bootstrap is giving me an error for this form and not my update form? Here are the files: forms.py: from django import forms from . import models from django.forms import ModelForm class CreateBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) def __init__(self,*args,**kwargs): super().__init__(*args,**kwargs) class UpdateBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) class DeleteBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) ` views.py: class UpdateBouquet(UpdateView): model = models.Bouquet form_class = forms.UpdateBouquetForm template_name = 'products/update_bouquet.html' success_url = reverse_lazy('products:shop') def form_valid(self,form): self.object = form.save(commit=False) result = 0 for flower in self.object.flower.all(): result += flower.price self.object.price = result self.object.save() return super().form_valid(form) class DeleteBouquet(DeleteView): model = models.Bouquet form_class = forms.DeleteBouquetForm template_name = 'products/delete_bouquet.html' success_url = reverse_lazy('products:shop') products/update_bouquet.html: {% extends 'site_base.html' %} {% load bootstrap3 %} {% block content_block %} <form method="post"> {% csrf_token %} {% bootstrap_form form %} <input type="submit" class="btn btn-outline-success" value="Save bouquet and continue shopping"> </form> <h6><a href="{% url 'products:detail_bouquet' pk=bouquet.pk %}">Back to bouquet</a></h6> {% endblock %} products/delete_bouquet.html: {% extends 'site_base.html' %} {% load … -
django.template.exceptions.TemplateSyntaxError: Could not parse some characters: |{{b.count}}||rangef
I'm trying to loop in a Django template by using a custom filter, but for some reason I receive this error: django.template.exceptions.TemplateSyntaxError: Could not parse some characters: |{{b.count}}||rangef myfilters.py @register.filter(name='rangef') def rangef(number): return range(number) index.html <div class="container"> {% for i in {{b.count}}|rangef %} <p>Some text</p> {% endfor %} </div> Important to mention that b.count is an Integer field. Appreciate your help! -
Django: NameError User_id is not defined attempting to query user's account page
After deleting the "blog post", i would like to return back to the accounts page which is account:view. However i faced the following error that tells me that user_id is not defined. This is a NameError, as seen in the traceback. I tried to add in the line user_id = kwargs.get("user_id")above the account = Account.objects.get(pk=user_id) as I did in the accounts.views.py but it ended up returning another error. Can someone advise how I should define the user_id in this view, and perhaps how i should define the account as well in other for me to correctly return to the user's account page. Many thanks! Traceback: Traceback (most recent call last): File "/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view return view_func(request, *args, **kwargs) File "HomeFeed/views.py", line 147, in delete_blog_view account = Account.objects.get(pk=user_id) NameError: name 'user_id' is not defined In HomeFeed App: views.py @login_required def delete_blog_view(request,slug): context = {} account = Account.objects.get(pk=user_id) blog_post = get_object_or_404(BlogPost, slug=slug) blog_post.delete() return redirect(request.META.get('HTTP_REFERER', 'account:view', kwargs={'user_id': account.pk })) In 'account' App: urls.py: path('<user_id>/', account_view, name="view"), views.py def account_view(request, *args, … -
Django redirect from one view to another WITH PARAMETERS
User submits form of Checkout in my e-commerce website, now I want him to redirect to index function directly. def checkout(request): if request.method == "GET": return render(request, 'shop/checkout.html') else: # ... DO SOME WORK ... response = redirect(index) return response Above code snippet works fine, But when I do response = redirect(index,msg="Order has been placed"). I get error Note that my Index Function has parameter msg defined. def index(request, msg=False): -
How do distinguish between multiple forms submitted in one form in Django?
I have multiple forms of the same base class like this: class DatabaseForm(forms.Form): active = forms.BooleanField(required=False) # Determines, if username and password is required username = forms.CharField(label="Username", required=False) password = forms.CharField(label="Password", required=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['active'].label = self.label def clean(self): cleaned_data = super(DatabaseForm, self).clean() active = cleaned_data.get("ative") username = cleaned_data.get("username") password = cleaned_data.get("password") if active and not (username and password): raise forms.ValidationError("Please fill in the required database configuration") return cleaned_data class MySQLForm(DatabaseForm): label = "MySQL" class PostgreSQLForm(DatabaseForm): label = "PostgreSQL" class SqliteForm(DatabaseForm): label = "Sqlite3" So only if the user chooses a database, he must fill in the username and password for it. In my template, the form looks like this: <form action="." method="post"> {% csrf_token %} {{ mysql_form }} {{ postgres_form }} {{ sqlite_form }} <a id="database-submit-btn" href="#submit" class="btn btn-success submit-button">Submit</a> </form> Problem: When the user chooses a database by selecting the 'active' field, the 'active' fields of the other databases get set to True. It seems like I can't distinguish between the multiple fields, as they have the same key in the POST request (but I'm not sure that's the whole problem): 'username': ['mysql test', 'postgres test', 'sqlite test'], 'password': ['mysql password', 'postgres password', 'sqlite … -
how do I create the best relationships for my models
I need help - i am trying to connect my client model to my admin,senior employee- for my program i am want my admin and my senior to be able to add a new client and see all of the clients in the database but the employee will only see the clients they added into the database - i also want my admin and senior employee to be able to change the employee assigned to my client - excuse the mistakes i am still new to coding class CustomUser(AbstractUser): user_type_data=((1,"Admin"),(2,"senioremployee"),(3,"employee")) user_type=models.CharField(default=1,choices=user_type_data,max_length=20) class admin(models.Model): id = models.AutoField(primary_key=True) admin=models.OneToOneField(CustomUser, on_delete=models.CASCADE) Dob = models.DateField() Nationality = models.TextField() Address = models.TextField() Postcode = models.TextField() Telephone = models.TextField() Wage = models.TextField() Passportnumber = models.TextField() passportexpirydate = models.DateField() gender = models.CharField(max_length=255) profile_pic = models.FileField() kinname = models.TextField() kinrelation = models.TextField() kinaddress = models.TextField() kinphonenumber = models.TextField() kinemail = models.TextField() profile_pic = models.FileField() created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now_add=True) objects = models.Manager() class senioremployee(models.Model): id = models.AutoField(primary_key=True) admin=models.OneToOneField(CustomUser, on_delete=models.CASCADE) Dob = models.DateField() Nationality = models.TextField() Address = models.TextField() Postcode = models.TextField() Telephone = models.TextField() Wage = models.TextField() Passportnumber = models.TextField() passportexpirydate = models.DateField() gender = models.CharField(max_length=255) profile_pic = models.FileField() kinname = models.TextField() kinrelation = models.TextField() kinaddress = models.TextField() kinphonenumber = models.TextField() … -
how to configure urls for news_details ? i want to go to news_details page when linked is clicked?
enter image description here enter image description here enter image description here enter image description here enter image description here -
Setting up apache virtual hosts for two django websites on windows server
I am trying to setup two django websites on a windows server platform with Apache. I am able to run both sites individually via apache successfully. But now running them together via virtual hosts seems to be tricky. Here is my attempt on configuration of both httpd file and wsgi files- Apache httpd config - LoadFile "c:/python/python39.dll" LoadModule wsgi_module "c:/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd" WSGIPythonHome "c:/python" #Virtual host for first site <VirtualHost *:80> WSGIScriptAlias / "C:/doctormainfolder/doctorwebsite/doctorwebsite/wsgi.py" ServerName doctor.com <Directory "C:/doctormainfolder/doctorwebsite/doctorwebsite/"> <Files wsgi.py> Require all granted </Files> </Directory> Alias /static "C:/doctormainfolder/doctorwebsite/static/" <Directory "C:/doctormainfolder/doctorwebsite/static/"> Require all granted </Directory> ScriptInterpreterSource Registry </VirtualHost> #Virtual host for second site <VirtualHost *:80> WSGIScriptAlias / “C:/betamainfolder/betawebsite/betawebsite/wsgi.py" ServerName beta.com <Directory "C:/betamainfolder/betawebsite/betawebsite/"> <Files wsgi.py> Require all granted </Files> </Directory> Alias /static “C:/betamainfolder/betawebsite/static/" <Directory “C:/betamainfolder/betawebsite/static/"> Require all granted </Directory> ScriptInterpreterSource Registry </VirtualHost> Here are wsgi file details for first website import os import os import sys path = 'C:/doctormainfolder/doctorwebsite' if path not in sys.path: sys.path.append(path) from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'doctorwebsite.settings') application = get_wsgi_application() Here are wsgi files details for second website - import os import sys path = 'C:/betamainfolder/betawebsite' if path not in sys.path: sys.path.append(path) from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'betawebsite.settings') application = get_wsgi_application() -
Celery/Django: shared_task tasks disappeared or not registering from task registry when starting a worker
When booting up a worker, it lists all of the registered shared_tasks that can be consumed by the worker. When adding "proper" code to one of the shared_tasks (rather than test code) all of sudden the tasks were not registering. -
How do you assign number to a view in html
HTML <div class="tabcontainer" id="tabcon" style="background-color: aquamarine"> <ul id="navigation1"> <li class="tabli" id="button1"><button class="tabs">tab 1</button></li> <ul id="navigation2"> <li id="tabli"> <button onclick="newTab()" class="addbut" style="text-align: center"> + </button> </li> </ul> </ul> </div> Firstly how do you give different tab view. For example if you want one thing open in one tab and another in a different tab. Would you use JavaScript to hide and show different elements or I there a way using Django you can implement tabs. and another problem I'm facing is that I've designed these tabs that are each meant to display a different view, and the name of the tab is assigned dynamically, when a user inputs what they want the tab to be called. but can also change to. My first thought is to use a loop but this means you can't go back and change a value. so how could I assign each tab view with a value. Sorry if this is a beginner question to ask I'm quite new to this. -
How to host django on iis
I am trying to host my django website on IIS webserver. I have python 3.9 (64bits), django 3.1.4 and wfastcgi 3.0.0. I also have djangorestframework. I have tried everything but this error is coming. HTTP Error 500.0 - Internal Server Error An unknown FastCGI error occurred web.config <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off" /> </system.web> <system.webServer> <httpErrors errorMode="Detailed" /> <handlers> <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\users\administrator\appdata\local\programs\python\python39\python.exe|c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" /> </handlers> </system.webServer> <appSettings> <!-- Required settings --> <add key="WSGI_HANDLER" value="Website.wsgi.application" /> <add key="PYTHONPATH" value="D:\Users\Manas\Projects\Cecrets\Web" /> <add key="WSGI_LOG" value="D:\Users\Manas\Projects\Cecrets\Web\wfastcgi.log"/> <!-- Optional settings --> <add key="DJANGO_SETTINGS_MODULE" value="Website.settings" /> </appSettings> </configuration> Please help me!!! -
Do I need any webdevelopment/webdesign background before learning Django?
I am about to start learning Django and while I have experience with Python and SQL I have no experience with web development or websites in general. I have been searching for advice online on which are the requirements or knowledge I need before start learning Django and develop my first website. The answers always suggest to learn Python but there is almost nothing on what level of webdevelopment/webdesign I need to have to best understand Django. Can anyone help me on that? Furthermore, is Django all I need to learn for the back-end or is there anything else I should learn? Sorry for not being super specific on the issue and thanks in advance. -
Django returns another message when the form is validated
I want to validate the mobile field but when I do clean_mob and return the message it turns out completely different I want to give it back 'Cannot be 1 character' but return 'This field cannot be null.' How can it be rectified and what prevents it? Thanks in advance This is my code views.py --> from django.shortcuts import render, HttpResponse from .forms import SignUpForm from django.http import HttpResponseRedirect from django.shortcuts import redirect from django.contrib.auth.forms import authenticate from django.contrib.auth import login def home(request): if request.method=="POST": form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) return redirect('/') else: form = SignUpForm() return render(request, 'home/home.html', {'form': form}) def about(request): return render (request, 'home/about.html') forms.py ---> from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ User = get_user_model() class SignUpForm(UserCreationForm): username = forms.CharField(max_length=30, widget=forms.TextInput(attrs={'placeholder': 'სახელი'})) email = forms.EmailField(max_length=200, widget=forms.TextInput(attrs={'placeholder': 'მაილი'})) def __init__(self, *args, **kwargs): super(SignUpForm, self).__init__(*args, **kwargs) self.fields['password1'].widget.attrs['placeholder'] ="პაროლი" self.fields['password2'].widget.attrs['placeholder'] ="გაიმეორეთ პაროლი" self.fields['mob'].widget.attrs['placeholder'] ="ტელეფონი" for field_name, field in self.fields.items(): field.widget.attrs['class'] = 'inp' for k, field in self.fields.items(): if 'required' in field.error_messages: field.error_messages['required'] = … -
Token authentication not working django rest framework
I am using token authentication for my current project but I have one problem, I can not authenticate a use for the life of me. To test my authentication I created a superuser and then the command python manage.py drf_create_token test1. And then created this view: class HelloView(APIView): permission_classes = (IsAuthenticated) def get(self, request): content = {'message': 'Hello, World!'} return Response(content) In my setting.py file I have: INSTALLED_APPS = [ ... # ... 'rest_framework', 'rest_framework.authtoken', 'backend', 'frontend' ] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.TokenAuthentication', ], } And when I test my API I keep geting: { "detail": "Authentication credentials were not provided." } What am I missing here? can anyone tell me? Thank you in advance. -
Post hit/views count are not showing
I am going through a Django tutorial. In my Blog App, i am trying to count the views/hit counts in the blog post. views.py def detail_view(request,id): data = get_object_or_404(BlogPost,pk=id) count_hit = True if request.method == 'POST': comment_form = CommentForm(data=request.POST) if comment_form.is_valid() else: comment_form = CommentForm() context = {'data':data,'count_hit':count_hit} return render(request, 'mains/blog_post_detail.html', context ) urls.py path('hitcount/', include(('hitcount.urls', 'hitcount'), namespace='hitcount')), blog_post_detail.html <a>Title : {{ data.post_title }}</a> <p>Views: {% get_hit_count for data %}</p> models.py class BlogPost(models.Model): post_creater = models.ForeignKey(User,default='',null=True,on_delete = models.CASCADE) post_title = models.CharField(max_length=500,default='') date_added = models.DateTimeField(auto_now_add=True,null=True) hit_count_generic = GenericRelation(HitCount,object_id_field='object_pk',related_query_name='hit_count_generic_relation') def __str__(self): return self.post_title The Problem I have put the hit/views count in blog_post_detail.html. BUT when i open post in browser , It shows ---Views:0. What i have tried 1). I have applied all the migrations. 2). I have inserted the hitcount app in INSTALLED_APPS in settings.py Help me in this ! I will really appreciate your Help. Thank You In advance.