Is there a way to have custom content with mezzanie/Django - django

I'm new using Mezzanine and figured out how to set-up pages where I can manage content from Admin page.
But I have static pages, where I want to store some content and being able to control that content from Admin page.
Is this something I can do with Mezzanine?
I imagine that I need to create a model with richtext field add that model to admin interface and than somehow access to that model through templatage.
But any exact example would greatly appreciated.
Thanks!

See the docs on creating custom content types. The primary approach is to subclass the Page model and add your custom fields.
Alternatively, if your custom content is conceptually independent from your pages, it might make sense to create independent models with relational fields to the RichTextPage model and edit them through inlines.
Note that the mezzanine docs on custom content types and the django docs on inlines use the same author/book example so you can easily compare the two strategies.

Related

Registering a dummy model in Django admin to control multiple models data

Is it possible to register a dummy model (Does not exist in db) that will display data from multiple models in one page?
Maybe just list all objects and when use click on one, a new webpage is opened with details of the clicked on objects? Which is usually this view:
admin:{app_name}/{model_name}/{object_id}/change
The closest standard solution to what you want are Django inlines:
https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#using-generic-relations-as-an-inline
I fail to see how you could create a model not present in the db.

Adding a new section in Mezzanine CMS (Django) admin

I'm totally new to Mezzanine CMS. I got handed a site to work with and so far I've been able to do all the changes without problem. I've run across a problem in which they want a new section in the home page. I go to the admin section to edit the home page, but there is no extra content field.
On the home page, I see 4 sections "content" "priorities" "testimonials" and "clients". I would like to have another "content" area as a 5th section. How do I go on and add this section? I'm totally new to Django but would be appreciative if someone could explain or point in the right direction.
Here is a link to an image for reference.
https://imgur.com/a/sUKOtvS
Thanks in advance
The homepage content would be backed by a Django model with attributes for the partners and testimonial fields. You'll need to find the Python class for this model in your code base (you could search for those field names), and you'll need to add a new attribute for the new section you need.
Django and Mezzanine have lots of different field types you can use for these attributes, so consult their respective documentation for how those work (Django's are a lot more comprehensive, so start there).
Once you've done that, you'll need to create a database migration for the new attribute - that adds the field to the database table that will store the actual content, again consult the Django documentation for how these work.
Finally you may need to add the new field to the Admin class, which is the Python class (similar to the model) that controls which fields appear in the admin interface, and how they appear. I say "may" as these generally appear automatically without any code, but if things have been modified to a certain extent, you may need to do this manually.

Django-cms Edit model placeholder before model is added

Is there a good way to implement editing of a PlaceholderField before the model is added to an app?
I have an app with an apphook, and at present one has to create the model in the admin interface, save it (causing it to appear on the website), and then add the CMS content to the already-visible rendering of the model. Clearly this isn't very good.
Ideally I would like to be able to create the Placeholder content 'inline' along with the rest of the model.
What would be the best way to go about this? Is there an existing method, or do I hack the admin interface and the model's save method using the CMS API?
Thanks

form from multiple models

I need to create a form where the rows are a list of users and the columns are all the user's permissions. The models are the default django User's and django Permission's models.
How can I do this things? Are there a way to do by django forms or I must do manually with django and js?
If you just want to view this data, extract the relevant information (User and Permission instances), and then generate a table using django templates. Django intentionally does not 'bless' any css or js frameworks, so you are required to do the html yourself (using tools of your choosing).
Forms aren't going to help you here I don't think. I advise you to draw up what it is you want to see, and start figuring out what the html is going to need to look like. Forms in django are simply a mechanism for passing data between django and the user. You are free to render them how you wish.

Django admin: two change lists on the same page

I am trying to make an overview page for one of my models I have read through all of http://www.djangobook.com/en/1.0/.chapter17/ and understand how I can add my own custom views for a model to the django admin.
What I am currently trying to do is add multiple filtered change lists (presenting some child models) onto my "overview" page for the model. In these I would like to be able to make use of some of the admin features such as editable fields or actions.
Does anyone have some pointers on how I can best get started with this.
Check this out
He created a proxy model for the original model to avoid the conflict. You can create a new model admin or inherit the old ModelAdmin(as shown in the link)