class Property(models.Model):
  property_id = models.AutoField(primary_key = True)
  property_name = models.CharField("Name", max_length = 30)
  user = models.ForeignKey(User)

class PropertyForm(ModelForm):
  class Meta:
    model = Property
    exclude = ('user')

def addProperty(request):
  formContent = PropertyForm(request.POST)
  formContent.save(commit = False)
  formContent.user = request.user
  formContent.save()

+-------------+------+---------+
| property_id | user | user_id |
+-------------+------+---------+
|           7 | NULL |    NULL |
+-------------+------+---------+
+-------------+------+---------+
| property_id | user | user_id |
+-------------+------+---------+
|           7 | NULL |    NULL |
+-------------+------+---------+
.
Problem.
formContent.user = request.user (has no effect stores null value)
But if print str(request.user) it prints the username.. so
request.user is not NULL..

Any help is appreciated.

Thanks and Regards,
Ramya Krishnan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to