I have extended Django User model (site members as opposed to users) and 
I want to approve them before they can use all site features. Below is 
my model:

class Member(models.Model):
        user = models.ForeignKey(User)
        ...
        is_approved - models.NullBooleanField(default = False)
        ...

Now, I want members to use site forms (not admin) to edit their profile 
details. Obviously, I don't want them to approve themselves, so I use 
hidden input value in my form:

<input type="hidden" id="id_is_approved" name="is_approved" value="{{ 
object.is_approved }}" />

However, whenever a member (even approved member) saves their profile, 
the value of "is_approved" is set to NULL.

By the way, I'm using generic views. I looked at the admin interface 
source for this model type of input code and found this:

<label for="id_is_approved">Approved?:</label>
   <select id="id_is_approved" class="vNullBooleanField" 
name="is_approved" size="1">
     <option value="1">Unknown</option>
     <option value="2">Yes</option>
     <option value="3">No</option>
   </select>

I assume that the framework translates this into appropriate values 
before saving the record and it works fine using admin interface.

When I looked at the value of {{ object.is_approved }} in my template, 
the value for approved member is "1", and when that profile is saved, 
the value of is_approved changes to NULL.

What is the proper way of handling this type of situation?


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

Reply via email to