Posted By

sethbuntin on 07/19/07


Tagged


Versions (?)

Change Django Queryset to Dictionary


 / Published in: Python
 

  1. def form_data(form, queryset):
  2. for field in form.base_fields.keys():
  3. data[field] = getattr(queryset, field)
  4. return data
  5.  
  6. data = form_data(YourForm, queryset)

Report this snippet  

You need to login to post a comment.