No problem, glad it could help =)

On Tue, Mar 25, 2014 at 11:17 AM, laperl <[email protected]> wrote:

> Thank you very much Josh,
>
> very clear, and good job with your articles in bitofpixels :)
>
> El dilluns 24 de març de 2014 16:00:46 UTC-5, Josh Cartmell va escriure:
>>
>> Hey laperal,
>>
>> Near the bottom of settings.py you see
>>
>> try:
>>     from local_settings import *
>> except ImportError:
>>     pass
>>
>> You could probably do something similar to import things from your app.
>>
>> You only need to unregister/register if you want to change the admin
>> class and use your own.
>>
>> I wrote that blog post, so that is the way that I would do it.  You would
>> probably want something like (it could go inside an admin.py file):
>>
>> from mezzanine.galleries.admin import GalleryImageInline
>>
>> GalleryImageInline.fields += ['your_new_field]
>>
>> The code above may not be exactly right, but you would want something
>> along those lines.
>>
>> The other option is to unregister/register a new class for Gallery.
>>
>>
>> On Sun, Mar 23, 2014 at 10:24 AM, laperl <[email protected]> wrote:
>>
>>> Thank you Josh for your responses,
>>>
>>>
>>> There may be some other way to encapsulate code in your app, but the
>>>> Mezzanine way is to use EXTRA_MODEL_FIELDS.
>>>>
>>>> Ok, Is it possible to move the settings.py inside my app, only to put
>>> these particular things?
>>>
>>>
>>>
>>>> The Page admin automatically picks up additional fields if a models
>>>> admin class doesn't specify it's own fields/fieldsets.
>>>>
>>>> OK understood, but then when I have to unregister and register?
>>>
>>>
>>>> Could you explain your last question a bit more?  You could probably
>>>> monkey patch the additional field onto the GalleryImageInline class.
>>>>
>>>>
>>> The galleries/admin.py is:
>>>
>>> class GalleryImageInline(TabularDynamicInlineAdmin):
>>>     model = GalleryImage
>>> class GalleryAdmin(PageAdmin):
>>>     class Media:
>>>         css = {"all": ("mezzanine/css/admin/gallery.css",)}
>>>     inlines = (GalleryImageInline,)
>>> admin.site.register(Gallery, GalleryAdmin)
>>>
>>> And I inject a new field that is shown very bad in the admin page, and I
>>> want to customize this. Do you have some examples and documentation about
>>> monkey patch? I read some in http://bitofpixels.com/blog/
>>> techniques-for-modifying-mezzanine/ and another sources but I can't
>>> understand exactly how and what is this. And the best, how you do this?
>>>
>>> Thank you very much
>>>
>>> laperl
>>>
>>>
>>>  --
>>> 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 [email protected].
>>>
>>> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to