76 questions
0 votes
2 answers
67 views
How can I merge different Db Models into one?
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. ...
1 vote
1 answer
111 views
Django Base Page is blank
I'm following this tutorial to learn Django and I've followed part 4 as in the video, but when I reload my page, it's always blank. I've looked at other posts that were also experiencing a blank page, ...
0 votes
1 answer
92 views
Inherit methods in Django rest framework
I'm new to learning django rest framework & python. I'm currently trying to inherit a few methods to which I don't know how. An alternative is I copy the same code which is code replication and ...
0 votes
0 answers
27 views
I kept receiving Template Does Not Exist
create.html {% extends 'base.html' %} **views.py** Def index(request): return render(request, ''main/create'', {}) I kept receiving template does not exist . Please help!
2 votes
1 answer
524 views
How to maintain a table of all proxy models in Django?
I have a model A and want to make subclasses of it. class A(models.Model): type = models.ForeignKey(Type) data = models.JSONField() def compute(): pass class B(A): ...
0 votes
1 answer
716 views
Django – Migrate a field from a child model to its parent model – Manual migration for inheritance leads to a `FieldError`
Short version I'm trying to run a custom migration (via RunPython) that involves an inherited model, say Restaurant. However a FieldError exception is raised at Restaurant.objects.all(), specifying ...
0 votes
1 answer
71 views
Template Inheritance Does Not Work - Django Tutorial
I am following Corey Schafer' Django tutorial. I have reached where I have to create a base.html template inheritance. After adjusting everything according to my project and running the server, my ...
1 vote
1 answer
100 views
Implementing the charity and Benefactor model in Django
am new to Django and I getting some difficulties in implementing this model in Django: here's my fiels : . ├── accounts │ ├── admin.py │ ├── apps.py │ ├── models.py │ └── views.py ├── ...
0 votes
0 answers
351 views
Using Django models how would I organize URL, Hostname, IP Address information with trickling-up ValidationError exceptions? Inheritance or?
I have three models (URL, Hostname, IPAddress). If I create a URL the overridden save() method of that class finds the hostname and does get_or_create() for Hostname. The save() method for Hostname ...
0 votes
1 answer
33 views
Django inheritance avoid to create many html file
i am new in Django. I have task , i have Horoscope website , there is 12 Zodiac signs Aquarius,Aries and etc.... In Aquarius.html are subcategory like Aquarius love , Aquarius finance .... Template is ...
0 votes
1 answer
1k views
Add operation to save method of abstract save method of parent model in Django
I create base model and inherit that in all of my models. This is my BaseModel: class BaseModel(models.Model): create_date = models.DateTimeField(auto_now_add=True) update_date = models....
3 votes
0 answers
383 views
Change inheritance to OneToOne relation in Django models
I have models that have a inheritance relationship. I want to turn this relationship into a OneToOne relationship, without removing any data in project. This is structure of models: class ...
2 votes
2 answers
321 views
Control object creation flow in Django inheritance models
I have been read some Django document about inheritance models and parent_link. Suppose that I have these models: class Parent(models.Model): #Some field goes here! class Child(Parent): #...
0 votes
1 answer
637 views
Conflict in form save() method when inherit from other save() method in Django
I changed the save method in the Django form.Then I inherited another save method from this method and made some changes to the child method ,that conflicted. I can't figure out how to fix the ...
2 votes
2 answers
2k views
Why Abstract=True dosen't inherit in Meta class of django model
I we have this models in django: class FotherModel(models.Model): # Some fields goes here! class Meta: # Some fields goes here! abstract = True class ChildModel(...