Answer the question
In order to leave comments, you need to log in
How to assign menu content type?
Good evening or afternoon.
I am writing a site, the menu items of which will be created by the admin at any time, as well as changed / deleted, etc.
Having created the "catalog" menu item, for example, you will need to specify the content type of the page of this directory. The type of page content will be something like this: catalog - the page displays a gallery of product pictures with a description; article - plain formatted text; etc.
When you select a content type, select boxes will appear according to the content type. For example, there is a model catalog - containing a list of goods with pictures and descriptions. There is an articles model containing articles - text.
For the menu, a MenuCategory model has been created, which is currently associated with the ContentType table - the content type. The ContentType model contains the fields: name, template, model, model_fields.
Answer the question
In order to leave comments, you need to log in
Model names in the singular
Article
Catalog
No need to dynamically link models
Usecase
By creating a menu item "catalog", for example, you will need to specify the content type of the page of this directoryno one will use it - dzhanga is not jumla
model_fields - a list of fields from model to model that should appear in the admin area to select a directory or become or otherwise.read how fields for editing are managed in the junga admin panel
is_show_in_menu = BooleanField(...
and transfer a list of those records to the template from the view that you want to show in the menu
Thank you for your help.
So far I have decided to go the following way.
Because the layout of the site and its content must be initially developed, then the menu sections must be initially defined. For example, we have the main menus: main, catalog, interesting, about the company.
For the "catalog" menu, I did this.
The Catalog model has been created. It contains product catalogs with subdirectories. Here I used mptt. As a result, I can get a Kitchen catalog with subdirectories: plastic, veneer, etc.
When creating a page layout, I connect tree lists from the Catalog model to the Catalog menu using mptt. Links to each section of the directory is an id in the database. Further, through the view, I process these links, as in the lesson of the official documentation.
It’s still easier, besides, the admin panel is not a website builder, like Joomla.
I looked at the proposed version of the finished menu module, though briefly, there was no menu creation through the admin panel in the example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question