Guest User

Untitled

a guest
Aug 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. How Can I include a field for a Generic Relation in an unbound form?
  2. ...
  3. foo = generic.GenericRelation(bar)
  4. ...
  5.  
  6. class myForm(ModelForm):
  7.  
  8. class Meta:
  9. model = foo
  10.  
  11. def foo_new(request):
  12.  
  13. if request.method == 'POST':
  14. form = myForm(request.POST)
  15. if form.is_valid()
  16. blah blah save
  17. else:
  18. form = myForm()
Add Comment
Please, Sign In to add comment