Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
New model field is not showing in admin page on PythonAnywhere
I have a problem when adding a new field to my models.py in PythonAnywhere. My models.py looks like the following, and I recently added the description field to it. class Post(models.Model): title = models.CharField(max_length=40, unique=True) cover = models.ImageField(upload_to='images/') description = models.CharField(max_length=100) author = models.ForeignKey(User, on_delete= models.CASCADE,related_name='blog_posts') slug = models.SlugField(null=False, unique=True) def get_absolute_url(self): return reverse('post_detail', kwargs={'slug': self.slug}) updated_on = models.DateTimeField(auto_now= True) shortcontent = models.CharField(max_length=150) content = RichTextUploadingField(blank=True) created_on = models.DateTimeField(auto_now_add=True) language = models.IntegerField(choices=LANGUAGE, default=0) status = models.IntegerField(choices=STATUS, default=0) class Meta: ordering = ['-created_on'] def __str__(self): return self.title I did run the makemigrations and python manage.py migrate commands, but the description field is not showing on my admin page: My admin.py looks like this: class PostAdmin(admin.ModelAdmin): list_display = ('title', 'status','created_on') list_filter = ("status",) search_fields = ['title', 'content', 'description'] prepopulated_fields = {'slug': ('title',)} class Media: js = ('ckeditor.js',) # do not write '/static/ckeditor.js' as Django automatically looks # in the static folder admin.site.register(Post, PostAdmin) What can I do to make sure the description field shows up on my admin page. I am using Python 3.8 in Pythonanywhere. -
Looking to modify host file in MacOs
I am following a tutorial on multi-tenancy in Django (10:58/11:42) and I would like to modify the hosts file which I located alreadty. When I try to add a single letter, I get rejected: But this leaves me quite confused, this is my laptop, and I do not have permission? Is there a way to do this differently ? -
You are trying to add a non-nullable field '_response_rendered'; django-markupfield
Upon wanting to add some Markdown to a project, I've decided to install django-markupfield to serve this objective. The only thing is that I've installed my models and associated fields ahead of making this decision; now replacing a TextField with MarkupField. When attempting to make a migration to adjust for this, the following is brought up: You are trying to add a non-nullable field '_response_rendered' to answer without a default; we can't do that (the database needs something to populate existing rows). Please select a fix: 1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 2) Quit, and let me add a default in models.py What would be an appropriate default value to add to the fields that will be prompting for such? I have never been too sure of this question in general when it comes to using Django as well, so clarification would be appreciated. https://github.com/jamesturk/django-markupfield class Question(models.Model): title = models.CharField(max_length=50) body = MarkupField( markup_type="markdown", escape_html=True ) dated = models.DateField(default=date.today) user_account = models.ForeignKey( 'users.UserAccount', on_delete=models.SET_NULL, null=True, blank=True, related_name="questions" ) tags = models.ManyToManyField(Tag, related_name='questions') objects = models.Manager() dateranges = DateRangeQuerySet.as_manager() status = QuestionStatusQuerySet.as_manager() class Meta: ordering = ['-dated'] … -
how to run Django locally as a windows executable app
I'm considering building app with Django for only one user that would run application locally on windows. I read about containerizing Django apps, but it's new for me. My goal is to run Django server on one click like a standard windows app and connect to it on localhost and interact with web browser. It is even possible? -
Data from request.POST are not being used to fill django form in views
I'm new in a Django and I try to exercise in easy project. My problem is that when I try to save the data from request.POST to ListForm it doesn't work. In the request.POST object I can find only a csrf_token. Can you help me,how to fix it? vievs: def home(request): if request.method=='POST': a=request.POST form =ListForm(request.POST) list_items = List.objects.all if form.is_valid(): form.save() list_items=List.objects.all #messages.success(request,('Udało się dodać')) return render(request,'home.html' ,{'list_items':list_items,'ok':'ok','a':a}) else: list_items = List.objects.all return render(request, 'home.html', {'list_items': list_items,'nie_ok':'nie_ok'}) form in html: <form class="d-flex" action="{% url 'home' %}" method="post"> {% csrf_token %} <input class="form-control me-2" type="search" id='teraz'placeholder="your new task" aria-label="Search"> <button type="submit" class="btn btn-outline-secondary" name="item">Add to list</button> </form> request.POST object: <QueryDict: {'csrfmiddlewaretoken': ['jCBOIk4mLr96d6ffPUDiLdJ01oVsw5eAATzeJqlQrC0H4TYTAP8OqnQFHrFZgOeo'], 'item': ['']}> models: class List(models.Model): item=models.CharField(max_length=50) completed=models.BooleanField(default=False) def __str__(self): return self.item forms: class ListForm (forms.ModelForm): class Meta: model =List fields=['item','completed'] -
I want to mention group the user either admin or customer while register(programmatically) in Django. I am new to Django
From the admin panel I can group the user either customer or admin. How do to programmatically? This my function register in views.py. @unauthenticated_user def register(request): form = CreateUserForm() if request.method == 'POST': form = CreateUserForm(request.POST) if form.is_valid(): form.save() profile = form.save(commit=False) profile.save() user = form.cleaned_data.get('username') us1 = User.objects.filter(username=user).first() us1.is_staff = True us1.is_superuser = False us1.save() messages.success(request, 'Account was created for ' + user) return redirect('loginpage') context = {'form':form} return render(request, 'register.html', context) -
Django changes datetime automatically
I have django project and one separate service. In django timezone is UTC+3 and in separate service I have written pure sql codes like below INSERT INTO Table(something,something,datetime) VALUES(%s,%s,%s) as a datetime field if I send 2021-04-28 01:00:00, django will save it 2021-04-28 04:00:00, 3 hours more. How can I implement db to store exactly what I send there. -
Permission error while access the sqlite3 with basic Django apps
I'm trying to follow the tutorial, but facing the below error. The error was disappeared when I changed the permissions of the parent folder and the db.sqlite3 file to 777, but that's not the good idea. What's the alternative? Reference: https://docs.djangoproject.com/en/3.2/intro/tutorial02/ Error: OperationalError at /admin/logout/ attempt to write a readonly database Request Method: GET Request URL: http://x.x.x.x/admin/logout/ Django Version: 3.1.6 Exception Type: OperationalError Exception Value: attempt to write a readonly database Exception Location: /opt/bitnami/python/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py, line 413, in execute Python Executable: /usr/bin/python3 Python Version: 3.8.7 Python Path: ['/opt/bitnami/python/lib/python38.zip', '/opt/bitnami/python/lib/python3.8', '/opt/bitnami/python/lib/python3.8/lib-dynload', '/opt/bitnami/python/lib/python3.8/site-packages', '/opt/bitnami/python/lib/python3.8/site-packages/setuptools-46.4.0-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/pip-20.3.4-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/virtualenv-20.4.2-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/six-1.15.0-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/filelock-3.0.12-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/distlib-0.3.1-py3.8.egg', '/opt/bitnami/python/lib/python3.8/site-packages/appdirs-1.4.4-py3.8.egg', '/opt/bitnami/apps/django/django_projects/tutorial'] Server time: Thu, 29 Apr 2021 06:17:14 +0000 Folder and file status: bitnami@ip---:/opt/bitnami/apps/django/django_projects$ ls -al total 12 drwxrwxr-x 3 root root 4096 Apr 22 05:09 . drwxr-xr-x 3 root root 4096 Apr 22 05:09 .. drwxrwxr-x 6 www-data www-data 4096 Apr 29 06:16 tutorial bitnami@ip---:/opt/bitnami/apps/django/django_projects$ ls -al tutorial/ total 168 drwxrwxr-x 6 www-data www-data 4096 Apr 29 06:16 . drwxrwxr-x 3 root root 4096 Apr 22 05:09 .. drwxr-xr-x 2 www-data www-data 4096 Apr 22 05:45 conf -rwxrwxrwx 1 www-data www-data 143360 Apr 29 06:16 db.sqlite3 drwxr-xr-x 4 www-data www-data 4096 Apr 28 16:08 hello_world -rwxr-xr-x 1 www-data www-data 664 Apr 22 … -
Django how to retrieve values from a database for an existing post so that we can edit
I am displaying a form for a posting which has already been saved to the database. I am giving the user the option to view the values as they are in the database and give him the option to edit them. However, it is not working for radio button and dropdown. I have tried writing something but it does not display the correct values. Here is the code snippet: <div class="form-row"> <div class="form-group col-md-6"> <label>Internship Type</label> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInLine1" name="internship_mode" class="custom-control-input" value="Office"> <label class="custom-control-label" for="customRadioInLine1">Office</label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInLine2" name="internship_mode" class="custom-control-input" value="Work From Home"> <label class="custom-control-label" for="customRadioInLine2">Work From Home</label> </div> </div> <div class="form-group col-md-6"> <label for="industry_type">Industry Type</label> <select class="form-control" id="industry_type" name="industry_type" selected=" {{ internship.industry_type }}"> {% for ind_type in industry_types %} <option value="{{ ind_type }}" {% if '{{ ind_type }}' == '{{ internship.industry_type }}' %}selected="selected" {% endif %}> {{ind_type}}</option> {% endfor %} </select> </div> -
Display the students named John Doe per class section using array
This is my example data. Those data are insurance claims and numbers in claims represents the number of claims per insurance category. What I was trying to do is { "Month": [ "April", "February", "March" ], "Claim(s)": { "": 18, "Energy": 1, "\"health\"": 5, "health": 38, "Credit": 7, "Bank Transfer": 5, "CAR": 1, "home": 5 } What I was trying to do is: Months: [Jan, Feb, March, Apr, May, Jun, July, Aug, Sept, Oct, Nov, Dec] Health: [0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Car: [0,1,0,0,0,0,0,0,0,0,0,0] Those element values represents that there were 29 health claims, and 1 car claim on month of February 2021. My code for the first data: class GetClaimsCompare_year(APIView): def get_claim_count(self, claims_data, claim_type): claims_count = claims_data.filter(claim_type = claim_type).count() return claims_count def get_claims_type(self, claim_per_month): return claim_per_month.claim_type def get(self, request): today = datetime.now() claims_data = Claims.objects.filter(modified_at__year =today.year) claim_per_month = claims_data.annotate(month = TruncMonth('modified_at')).values('month').annotate(claim_type=Count('id')) labels = [] claims_type = list(set(map(self.get_claims_type, claims_data))) final = {} for claims in claim_per_month: month_label = claims['month'].strftime('%B') labels.append(month_label) #labels.append(claims['month']) for claim_type in claims_type: final[claim_type] = self.get_claim_count(claims_data, claim_type) context = { 'Month':labels, 'Claim(s)':final } return Response(context) -
Python Django- How do I interact/handle an uploaded text file
I have python code that reads in a document and parses it through into key words. I'm new to Django, but I have a working project that the user uploads a document and that file is saved to a postgres database. I'm having a really hard time figuring out how combine this project with the python code; I don't understand how to take that upload file and and break it down into words. **What I'm desperate to understand:**is how a python script is added and applied in Django; and then take the returned output, pieces of the broken down text, can be stored under columns in a Postgres db. Similar to how a python code can read in a text file and split up it up into words and organize the words into columns in a pandas DB. I'm struggling a lot with applying this function in a django context. I'm not sure if it would be easier to apply a python script to the UploadFile.object or apply the python functions after form is validated. I'm having a hard time finding an explicit example of this. I would greatly appreciate if anyone could shed some light on this! code: import … -
Google Chrome limits borders of a page with blue dotted lines
Now I'm working on my pet project of a blog using Django. When I run the server in Google Chrome, it shows these blue dotted lines on a page, thus displacing all elements. At the same time, when I access the same site on Microsoft Edge, everything looks okay. What is the problem with this page in Chrome? The page looks like this in Chrome: Chrome And like this in Edge: Edge -
is there elif syntax error please find the error?
def mobile(request, data=None): if data == None: mobiles = Product.objects.filter(category='M') elif data == 'Redmi' or data == 'Samsung': mobiles = product.objects.filter(category='M').filter(brand=data) return render(request, 'app/mobile.html', {'mobiles': mobiles}) -
How to group by list of values in django
I'm trying to get api params: ?group_by=student,year, I get it in my endpoint like this: group_by_items = self.request.query_params.get('group_by') the result is a string that I need to pass it to the values method, so this is how I did it: group_by_items = group_by_items.split(',') res = res.values(group_by_items).annotate(presence=Sum('presence')) res is the queryset. after running this code I get this error: TypeError: unhashable type: 'list' How can I resolve this? Thank you. -
ValueError: not enough values to unpack (expected 4, got 3) using Django
using Django check_password() got this error, in database i have stored using hashed password using make_password() imported required statements from django.contrib.auth.hashers import make_password,check_password line giving error is password = check_password(pas, fetchRes[0][3]) here is my code def signin(request): res="" login_failed = False conn = sql.connect(host="localhost",user="root",password="",database="agroxpert") cur = conn.cursor() if request.method=="POST": met=request.POST aid=met['aid'] pas=met['pas'] inp=(aid,) cur.execute('''SELECT * from admin where AID=%s''',inp) fetchRes = cur.fetchall() password = check_password(pas, fetchRes[0][3]) if password and len(fetchRes) == 1: request.session['FID']=aid login_failed = False conn.commit() conn.close() return HttpResponseRedirect('administration/') else: login_failed = True res = "Unable to Signin Password or Admin Id entered is incorrect" print(res) return render(request,'admin.html',{"res":res,"failed":login_failed}) -
How to get count value of a ManyToManyField?
I have a model Post with a ManyToManyField field "User": class Post(models.Model): STATIC_CHOICES = ( ('draft', 'Draft'), ('published', 'Published') ) title = models.CharField(max_length = 255) slug = models.SlugField(max_length = 255) author = models.ForeignKey(User, related_name = 'blog_posts', on_delete = models.CASCADE) body = models.TextField() likes = models.ManyToManyField(User, related_name = 'likes', blank = True) upvotes = models.IntegerField(default = 0) created = models.DateTimeField(auto_now_add = True) status = models.CharField(max_length = 10, choices = STATIC_CHOICES, default = 'draft') def __str__(self): return self.title def total_likes(self): return self.likes.count() def get_absolute_url(self): return reverse("post_detail", args=[self.id, self.slug]) I understand that the method total_likes()returns the number of likes in the views. However, I want to display the number of likes in the upvotesIntegerField's default value. Basically, if I could do something like: upvotes = models.IntegerField(default = total_likes()) so that the number of likes show up as the default value in the IntegerField in the admin. However, since I cannot do that, what is the best way so that I can get the number of likes to show up in the IntegerField in upvotes? -
Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress
I am using helm upgrade xyz --install command and my release were failing due to other helm issues. So no successful release is done yet. Then one time when the above command was in progress, I pressed ctrl+c command. And since then it is showing Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress whenever I try helm upgrade again. When i do helm history helm history xyz It shows Error: release: not found. No I don't know how to roll back the previous operation so that I can try helm upgrade again. I tried --force too helm upgrade xyz --install --force but it is still showing some operation is in progress. So how can I roll back the previous process when I don't have any successful release. -
Django Email Template for loop not working
Im working with Django HTML Email. The list of data is working when I print() using terminal but when I call in email template, only the 1st data display in Html Email. I tried to run in Localhost everything is working even the for loop all data display in form of list. Please help me to figure out what are missing or wrong in my script.Thank You! After sending email, this is the email output, only the First data got listed This is the data that I want to display In Email Template send email script class HomeView(ListView): month = datetime.datetime.now().month elif month == 4: cstatus = vehicleData.objects.filter( Registration_month="APR", sent_email="No") s = "" for carreg in cstatus: print(carreg.PLATE_NO) s = carreg.PLATE_NO print(s) cstatus.update(sent_email="No") if s != "": subject = 'Sample' html_message = render_to_string('email.html', {'content':s}) plain_message = strip_tags(html_message) from_email = 'From <sampleemail@gmail.com>' to = 'sampleemail@gmail.com' mail.send_mail(subject, plain_message, from_email, [to], html_message=html_message,fail_silently=False) Template <body> <h2>Hi,</h2> <p> Please update before month End!</p> <ul> {% for vehicle in content %} <li>{{ vehicle }}</li> {% endfor %} </ul> </body> -
How can i share data between two tenants, like contacts list
i'm working on a small project using Django and i'm using Django tenancy Schemas, i need a help about sharing data between users, i found that can someone explain to me the role of with schema_context from tenant_schemas.utils import schema_context with schema_context(schema_name): is that make sense in my situation ? to solve my need ( sharing data between tenants ) -
Customize Django Log Entry Change_Message Field with the 3 Action Flags
Basically, I want to customize the change_message to make it more friendly, and show something in deletion action flag. Any approaches? image -
Markdownify; template won't wrap string
I'm using Markdownify (django-markdownify) to convert the markdown content from a user form into HTML. Yet I've encountered a bug of sorts where a long string with no whitespace is supplied. The subject string will not wrap in the container of a certain width of which {{ markdownify }} is inserted. However if strings with whitespace are provided they in fact do wrap. Has anyone using markdownify encountered this before? How would this be resolved so that strings as 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' wrap as expected? The string with the white space demonstrates the expected behavior. The markdown library is installed in INSTALLED_APPS. MARKDOWNIFY = { 'default': { 'WHITELIST_TAGS': [ 'a', 'abbr', 'acronym', 'b', 'blockquote', 'code', 'em', 'i', 'li', 'ol', 'strong', 'ul', 'pre', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ], "MARKDOWN_EXTENSIONS": [ 'markdown.extensions.fenced_code', 'markdown.extensions.extra', ] } } {% load markdownify %} <div class="featured_content"> <div class="response_container"> {{ answer.response|markdownify }} </div> </div> -
django-admin site display problem in different port
I got a very confused problem. When I use port 8000 to run my django project. The django-admin site display normal. However, when I use port 80 to run my django project. The django-admin site display a little different in page layout. Such as the positions and size of the search bar and the form are different. They both can load the css and no error comes out -
why the django static file not loading
settings.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = 'j2-%r(!2*(3$(j96or3h23cp(+5%c!1&v+z9(%-v-9%pr*sdtx' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'authn', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'first.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'first.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'login', } } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = '/static/' STATICFILES_DIRS=[ os.path.join(BASE_DIR,'static') ] files location urls.py from django.contrib import admin from django.urls import path from django.conf.urls.static import static from . import views urlpatterns = [ path('',views.home,name="home"), path('register/', views.registerPage, name="register"), path('login/', views.loginPage, name="login"), path('logout/', views.logoutUser, name="logout"), ] html file i am trying to work on <head> <title>Nura Admin - Charts</title> <meta name="description" content="Charts | Nura Admin"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content="Your website"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- Favicon --> <link rel="shortcut icon" href= "{% static 'assets/images/atomic.png'%}"> <!-- Bootstrap CSS --> <link href="{% static 'assets/css/bootstrap.min.css'%}" … -
How do I fix "POST http://127.0.0.1:8000/admin/auth/user/ net::ERR_CONNECTION_REFUSED" error in Vue project?
I'm making a Vue project and, when making an axios.post call in my vue file, I get POST http://127.0.0.1:8000/admin/auth/user/ net::ERR_CONNECTION_REFUSED as an error on the site and a Uncaught (in promise) Error: Network Error at createError (createError.js?2d83:16) at XMLHttpRequest.handleError (xhr.js?b50d:84) error right after. The login method I'm attempting to use that's giving the errors: login() { axios.post('http://127.0.0.1:8000/admin/auth/user/', { username: this.username, password: this.password, }) .then(resp => { this.token = resp.data.token; console.log(this.token) localStorage.setItem('user-token', resp.data.token) }) } The full error: POST http://127.0.0.1:8000/admin/auth/user/ net::ERR_CONNECTION_REFUSED dispatchXhrRequest @ xhr.js?b50d:177 xhrAdapter @ xhr.js?b50d:13 dispatchRequest @ dispatchRequest.js?5270:52 Promise.then (async) request @ Axios.js?0a06:61 Axios.<computed> @ Axios.js?0a06:87 wrap @ bind.js?1d2b:9 login @ Header.vue?0418:44 $data.token.Object.onClick._cache.<computed>._cache.<computed> @ Header.vue?0418:17 callWithErrorHandling @ runtime-core.esm-bundler.js?5c40:154 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js?5c40:163 invoker @ runtime-dom.esm-bundler.js?830f:333 I've looked around in Django documentation and around stackoverflow for a couple hours and haven't found any solutions. Any assistance, critiques, comments, or questions would be appreciated. I'd be more than happy to provide any additional information needed. -
Cannot extend a tamplate in Django
I have a following template: {% load i18n %} {% load static %} <!DOCTYPE html> <html> <head> <title>{% translate "login page" %}</title> <link rel="stylesheet" type="text/css" href="{% static 'taskmanager/style/authpages.css' %}"> </head> <body> {% block testblock %} {% endblock testblock %} <form method="post" action="{% url 'login' %}" class="main-form"> {% csrf_token %} <label for="username">{% translate "User name: " %}</label> {{ form.username }} {{ form.username.errors }} <label for="password">{% translate "Password: " %} </label> {{ form.password }} {{ form.password.errors }} {% if form.errors %} {{ form.non_field_errors }} {% endif %} <input type="submit" value="{% translate 'sign in' %}"> <input type="hidden" name="next" value="{{ next }}"> <a href="{% url 'register' %}">{% translate "Register" %}</a> </form> {% block switch_lang_button %} {% endblock switch_lang_button %} </body> </html> and also I have a template to extend it: {% extends "registration/login.html" %} {% block testblock %} <div> testblock content </div> {% endblock testblock %} template settings in settings.py is standard and was not changed: TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] It seems to me that everything I have done is consistent with the documentation and I cannot figure out which of these is not working. I …