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



--~--~---------~--~----~------------~-------~--~----~
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