|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Non editable fields in adminHi,
I'm writing an application which makes a pretty heavy use of the newforms-admin administrative site. One recurring need is displaying of informative fields (fields which should not be editable from the admin site, but only viewed). For example, imagine to have a DateField field into a Story class, which is automatically updated every time a user writes a new story. It is desiderable to see this value in the admin site, but has no sense (actually is wrong) to allow modifications to it. Note that this is different from the purpose of the 'editable' attribute, what I'm talking about is a presentation-only feature, and for this reason we could put it into ModelAdmin classes: class StoryOptions(admin.ModelAdmin): readonly_fields = ('lastupdate',) People have been asking this a lot of times, at least here: http://code.djangoproject.com/ticket/342 http://code.djangoproject.com/ticket/611 http://code.djangoproject.com/ticket/1714 http://code.djangoproject.com/ticket/3990 Is there a working solution to display this kind of readonly data in the admin site? Thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@... To unsubscribe from this group, send email to django-developers-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Non editable fields in adminHow about creating a widget that just displays the data? Then override the form and use this widget instead of the default widget.
On Fri, Jul 4, 2008 at 6:14 PM, Alex Rades <alerades@...> wrote: Hi, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@... To unsubscribe from this group, send email to django-developers-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Non editable fields in adminYou mean this?
http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIchangetheattributesforawidgetonasinglefieldinmymodel. It seems there is quite a lot of code involved for each readonly field you want do display... something like readonly_fields would be way better IMHO. On Fri, Jul 4, 2008 at 10:19 PM, TiNo <tinodb@...> wrote: How about creating a widget that just displays the data? Then override the form and use this widget instead of the default widget. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@... To unsubscribe from this group, send email to django-developers-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Non editable fields in adminHi Alex, Check out this: http://www.djangosnippets.org/snippets/414/ and this: http://www.djangosnippets.org/snippets/323/ On Sun, Jul 6, 2008 at 12:47 PM, Alex Rades <alerades@...> wrote: > You mean this? > > http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIchangetheattributesforawidgetonasinglefieldinmymodel. > > It seems there is quite a lot of code involved for each readonly field you > want do display... something like readonly_fields would be way better IMHO. > > On Fri, Jul 4, 2008 at 10:19 PM, TiNo <tinodb@...> wrote: >> >> How about creating a widget that just displays the data? Then override the >> form and use this widget instead of the default widget. >> >> On Fri, Jul 4, 2008 at 6:14 PM, Alex Rades <alerades@...> wrote: >>> >>> Hi, >>> I'm writing an application which makes a pretty heavy use of the >>> newforms-admin administrative site. >>> >>> One recurring need is displaying of informative fields (fields which >>> should not be editable from the admin site, but only viewed). >>> For example, imagine to have a DateField field into a Story class, which >>> is automatically updated every time a user writes a new story. It is >>> desiderable to see this value in the admin site, but has no sense (actually >>> is wrong) to allow modifications to it. >>> >>> Note that this is different from the purpose of the 'editable' attribute, >>> what I'm talking about is a presentation-only feature, and for this reason >>> we could put it into ModelAdmin classes: >>> >>> class StoryOptions(admin.ModelAdmin): >>> readonly_fields = ('lastupdate',) >>> >>> People have been asking this a lot of times, at least here: >>> >>> http://code.djangoproject.com/ticket/342 >>> http://code.djangoproject.com/ticket/611 >>> http://code.djangoproject.com/ticket/1714 >>> http://code.djangoproject.com/ticket/3990 >>> >>> Is there a working solution to display this kind of readonly data in the >>> admin site? >>> >>> Thank you >>> >>> >>> >> >> >> > > > > > -- Best regards, Yuri V. Baburov, ICQ# 99934676, Skype: yuri.baburov, MSN: buriy@... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@... To unsubscribe from this group, send email to django-developers-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |