Answer the question
In order to leave comments, you need to log in
Changing a user's static page of a django site in the admin?
How model.py, views.py and urls.py should look like so that the user can easily change the title, text and background in the site header.
Answer the question
In order to leave comments, you need to log in
I won't write the code for you. But in general, it may look like this...
In models, oddly enough, write a model with all the necessary fields - name, text, background, addresses and phone numbers... If you use django sites , then you can bind it to the site model through OneToOneField .
In views, one class inherited from UpdateView suffices . In it, you override the get_object method so that an instance of the settings model is created if it does not exist in the database.
It makes no sense to write about urls - this is an auxiliary code.
Good luck!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question