django-inheritance

How can I merge different Db Models into one?

How can I merge different Db Models into one? Question: I have an old Django Project, which I started when I was a beginner. So far it worked but, due to some code refactoring I would like to do, I would like to change the original database models. Basically, I originally made many different models, …

Total answers: 2

Django templates: overriding blocks of included children templates through an extended template

Django templates: overriding blocks of included children templates through an extended template Question: I’m wondering if anyone knows how to deal with the following quirky template structure: ### base.html <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”> <html lang=”en”> <head> <title> {% block title %} Title of the page {% endblock %} </title> </head> <body> <header> {% …

Total answers: 3

In Django – Model Inheritance – Does it allow you to override a parent model's attribute?

In Django – Model Inheritance – Does it allow you to override a parent model's attribute? Question: I’m looking to do this: class Place(models.Model): name = models.CharField(max_length=20) rating = models.DecimalField() class LongNamedRestaurant(Place): # Subclassing `Place`. name = models.CharField(max_length=255) # Notice, I’m overriding `Place.name` to give it a longer length. food_type = models.CharField(max_length=25) This is the …

Total answers: 10