Fix Python – django templates: include and extends

I would like to provide the same content inside 2 different base files.
So I’m trying to do this:
page1.html:
{% extends “base1.html” %}
{% include “commondata.html” %}

page2.html:
{% extends “base2.html” %}
{% include “commondata.html” %}

The problem is that I can’t seem to use both extends and include. Is there some way to do that? And if ….

Fix Python – Does Python have a toString() equivalent, and can I convert a class to String?

I’m writing a ToDo list app to help myself get started with Python. The app is running on GAE and I’m storing todo items in the Data Store. I want to display everyone’s items to them, and them alone. The problem is that the app currently displays all items to all users, so I can see what you write, and you see what I write. I thought casting my to….

Fix Python – What is the equivalent of “none” in django templates?

I want to see if a field/variable is none within a Django template. What is the correct syntax for that?
This is what I currently have:
{% if profile.user.first_name is null %}

{% elif %}
{{ profile.user.first_name }} {{ profile.user.last_name }}
{% endif%}

In the example above, what would I use to replace “null”?
….

Fix Python – Django TemplateSyntaxError – ‘staticfiles’ is not a registered tag library

After upgrading to Django 3.0, I get the following TemplateSyntaxError:
In template /Users/alasdair//myproject/myapp/templates/index.html, error at line 1
‘staticfiles’ is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz

Here is my template
{% load staticfiles %}
Categories python Tags , , ,

Fix Python – how to iterate through dictionary in a dictionary in django template?

My dictionary looks like this(Dictionary within a dictionary):
{‘0’: {
‘chosen_unit’: ,
‘cost’: Decimal(‘10.0000’),
‘unit__name_abbrev’: u’G’,
‘supplier__supplier’: u”Steve’s Meat Locker”,
‘price’: Decimal(‘5.00’),
‘supplier__address’: u’No\r\naddress here’,
‘chosen_unit_amount’: u’2′,
‘city__name’: u’Jobu….

Fix Python – Iterate over model instance field names and values in template

I’m trying to create a basic template to display the selected instance’s field values, along with their names. Think of it as just a standard output of the values of that instance in table format, with the field name (verbose_name specifically if specified on the field) in the first column and the value of that field in the second column.
For exa….