Hi Rainell

I feel your pain with the lack of examples in the docs. I've had the exact
same feeling when I first started. They seem to be aimed at those who know
what they are doing, and as you learn more, they become more clear.
Mezzanine is a great project, but it does have its quirks.

Anyways, I've put together a small project to showcase the different types
of inline editing that I think that might help you.
https://github.com/rogervs/mezzanine-linking

Catalog is the main page that will be shown. Create this first.
Recipe is of type displayable, and can be assigned to a catalog page.
Then, there are 3 different types of ingredient models, purely for
demonstration purposes.

Ingredient1 in my opinion would be ideal for your situation, as you could
have a library of ingredients, and then you just select all the ingredients
from the list that are in your recipe, and you can reuse those ingredients
in other recipes. The only draw back ( as far as my knowledge is concerned
) with this approach is that you cannot order the ingredients in the admin
by dragging and dropping (and as someone who likes cooking, ALWAYS order
your ingredient list in the order that they are required for your recipe ).
I'm guessing the way to get around this ordering is to make it a manytomany
but through another model that contains the ordering for that specific
recipe. The hard part would be to get the admin to play along with this.
Never tried it, but sounds like a good approach. There's an order_by
templatetag that should be usefull for this. Haven't investigated it too
much, but looks like the way to go. The blog app actually does the
many-to-may admin interface  better by having two panes, once again, I
haven't looked at it, but you can scratch in it's source code if you want
to see how they have done that. If you're not sure where to find the file
that governs how the blog app does the many to many with the two panes, let
me know and I'll try and help you find it.

Ingredient3 & Ingredient4 are there to showcase the two orderable inline
model admins that I know. The problem with this approach though is that you
will have to create a separate banana for every recipe that requires
banana, which could result in you eventually having 100 bananas which are
exactly the same just because they are used in 100 recipes.

Hope this helps

(If anyone has any advice on the Ingredient1 ordering problem, I would love
to hear it)

Roger


On 14 September 2017 at 21:32, Rainell Dilou Gómez <rainell.di...@gmail.com>
wrote:

> Eduardo I have seen the video of your explanation and it is exactly the
> solution for me, thank you very much.
> In my opinion, for the beginners like me, would be of more help if the
> Mezzanine documentation were more explicit, with more examples.
> Now that I have lived through this experience I can understand better the
> explanation in the Content Architecture section, where Displayable and Page
> are explained, but there is an example only for Page. That is why I believe
> that the documentation could be more specific and with more examples.
> Thanks again.
>
> Il giorno giovedì 14 settembre 2017 13:12:56 UTC+2, Rainell Dilou Gómez ha
> scritto:
>
>> Hello,
>> I have created a custom content type and I have a problem with the
>> listing in the admin panel. If I extends PageAdmin
>>
>>
>> admin.site.register(Ingredient, PageAdmin)
>>
>> the create/edit page is rendered as in the image
>>
>>
>> <https://lh3.googleusercontent.com/-Ohd3o8QKwmg/WbpcWgjV5fI/AAAAAAAAAdc/i_yp_ntXQEcTMcfB8-5yFBsySLINt11sgCLcBGAs/s1600/Schermata%2B2017-09-14%2Balle%2B12.26.00.png>
>>
>> and this is great for creating and editing, but the listing in the page
>> section, as show in the following image, is a problem because the
>> Ingredients (my custom content type) will be many, will be hundreds.
>>
>>
>> <https://lh3.googleusercontent.com/-Yap3P0bVjw0/WbpbLnHhsMI/AAAAAAAAAdQ/HGkHjriVlRIMgb1qoH7OMxusCZQdvoEeACLcBGAs/s1600/Schermata%2B2017-09-14%2Balle%2B12.24.32.png>
>>
>> If instead I don't extend PageAdmin
>>
>> admin.site.register(Ingredient)
>>
>> my custom content type list is rendered as in the following image, in a
>> more convenient way, considering that there will be hundreds of Ingredients
>>
>>
>> <https://lh3.googleusercontent.com/-ehaJO4GKoHs/WbpfH1qDOFI/AAAAAAAAAdo/I2BKgYN5jyUADxoBgDpNIgJ3jM13JD0tACLcBGAs/s1600/Schermata%2B2017-09-14%2Balle%2B12.27.13.png>
>> but the create/edit page will be rendered as in the next image, and it
>> isn't convenient, considering that the fields are twice as many as are
>> shown in this image.
>>
>>
>> <https://lh3.googleusercontent.com/-eT-u4auTnCU/WbphFcKL65I/AAAAAAAAAd8/ZO51pAVa3SsThgkUJSPJs0OTGs_NZatIQCLcBGAs/s1600/Schermata%2B2017-09-14%2Balle%2B12.27.38.png>
>>
>> So how can I do to create/edit as when using PageAdmin and list as when
>> not using PageAdmin?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to