On Sun, Mar 22, 2009 at 8:23 PM, [email protected]
<[email protected]>wrote:

>
> I have a table where users can add their own rows, but the admin must
> approve it.
> So my model contains this:
>  dateAdminDecision = db.DateTimeProperty(auto_now=True)
>
> Obviously, at first, every row, even when the users added their data,
> was getting set to this date.
> But I only want the date to be set when the Admin approves the row
> using a special Admin form.
>
> What about the approach I have tried below, so far it seems to be
> working.  Is this technically called inspection or reflection?  I use
> the same template, but two different forms classes, each form class
> has different "exclude"s on it so the non-Admin sees a different set
> of fields than the Admin-user.
>
>  if users.IsCurrentUserAdmin():
>     MyModelName.__dict__["dateAdminDecision"].__dict__["auto_now"] =
> True;
>     form = AdminForm(data=request.POST or None, instance=conference)
>  else:
>     MyModelName.__dict__["dateAdminDecision"].__dict__["auto_now"] =
> False;
>     form = UserForm(data=request.POST or None, instance=conference)
>
> I saw in some other post that auto_now maybe going away soon.  I'm
> creating this app for GAE right now, but want to think broadly of how
> I might do this on an LAMP type server as well.
>
> Thanks,
> Neal Walters
>
>
>
> >
>
This is a question about google app engine(which has a totally seperate ORM
from Django's).  Their mailing list is the correct place to ask questions
about.

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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to