On Tue, Feb 10, 2009 at 12:35 AM, Ramdas S <ram...@gmail.com> wrote: > I think in many practical cases, you may require permissions also to be > tied in. I have a case where a form editing rights are tied to a some of > the fields, ie employee cannot edit certain fields, while managers can edit > the fields in a form. How do we do such cases? > > I could not find a reliable way, hence I fundamentally redirected users > based on user types. It is kind of hacky, and ugly. > > Any better suggestions > > On Tue, Feb 10, 2009 at 10:48 AM, Malcolm Tredinnick < > malc...@pointy-stick.com> wrote: > >> >> On Mon, 2009-02-09 at 21:14 -0800, Margie wrote: >> > I have a model that contains a 'created' field where 'editable' is set >> > to False in the model. >> > >> > I'd like to display the created field in my form, but not allow it to >> > be modified. I tried putting it in >> > the include list for the form, but that didn't seem to have any affect >> > (it didn't display in the form). >> > >> > Is there a way to do this in a form or do I need to simply put the >> > created field into my template separate from the display of the form? >> >> You could create a form Field subclass that only displays the data and >> never validates it or inserts it into cleaned_data for the form. In >> other words, a kind of read-only for field. There are a few details that >> would have to be sorted out, but it sounds eminently possible if you >> were going to do this a lot. One day we'll eventually add support for >> read-only items in the admin and we'll have to invent something like >> that for those, I suspect. >> >> On the other hand, I've always just inserted it directly into the form >> template when I've had this kind of situation. >> >> Regards, >> Malcolm >> >> >> >> >> > > > -- > Ramdas S > +91 9342 583 065 > > > > > > For something like you describe I would overide get_form() on ModelAdmin to just return a different form with the correct fields.
Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---