Re: extend Site Model
Use monkey patching, Luke? Have a nice day, Nikolay. On Fri, Jul 25, 2008 at 20:35, José Moreira <[EMAIL PROTECTED]> wrote: > > Hello, > > is it possible to extend Site Model to add additional properties? > > thank you > > -- > José Moreira > Vila Nova de Gaia > Portugal > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: extend Site Model
> monkey patching = alter django code? Not exactly. You should not modifying the django code, but alter the code dynamically. For instance, when I needed to add to model User an additional "Customer" field, I have made it as: # Monkey-patching User model User.add_to_class('customer', models.ForeignKey(Customer, null=True, blank=True)) User._meta.admin.fields += ( ('Extensions', {'fields': ('customer',)}), ) User._meta.admin.list_display += ('last_login', 'customer') Afraid, this code should be now updated in case of using newforms-admin. Have a nice day, Nikolay. On Fri, Jul 25, 2008 at 21:00, José Moreira <[EMAIL PROTECTED]> wrote: > > monkey patching = alter django code? > > may the source be with you :) > > 2008/7/25 Nikolay Panov <[EMAIL PROTECTED]>: >> Use monkey patching, Luke? >> >> Have a nice day, >> Nikolay. >> >> >> >> On Fri, Jul 25, 2008 at 20:35, José Moreira <[EMAIL PROTECTED]> wrote: >>> >>> Hello, >>> >>> is it possible to extend Site Model to add additional properties? >>> >>> thank you >>> >>> -- >>> José Moreira >>> Vila Nova de Gaia >>> Portugal >>> >>> > >>> >> >> > >> > > > > -- > José Moreira > Vila Nova de Gaia > Portugal > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: extend Site Model
monkey patching = alter django code? may the source be with you :) 2008/7/25 Nikolay Panov <[EMAIL PROTECTED]>: > Use monkey patching, Luke? > > Have a nice day, > Nikolay. > > > > On Fri, Jul 25, 2008 at 20:35, José Moreira <[EMAIL PROTECTED]> wrote: >> >> Hello, >> >> is it possible to extend Site Model to add additional properties? >> >> thank you >> >> -- >> José Moreira >> Vila Nova de Gaia >> Portugal >> >> > >> > > > > -- José Moreira Vila Nova de Gaia Portugal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---