For example I have WikiPages with Many2Many with "Categories"

in a edit view I have:
################
page_id = Page.objects.get(slug__exact=slug)
manipulator = Page.ChangeManipulator(page_id.id)
page_data = manipulator.flatten_data() # this is importanta
....
form = forms.FormWrapper(manipulator, page_data, errors)
return render_to_response('wiki/edit.html', {'form': form})
################
and in a template simple:
########################
 <td>Categories:</td><td> {{ form.categories }}
    {% if form.categories.errors %}<br>*** {{
form.categories.errors|join:", " }}{% endif %}
########################

To get for example all entries from a category you could do:
category = Category.objects.get(id=category_id)
all_news = category.news_set.all()
(where news is my news app)
The same is possbile in the other way as shown in the Many2Many examples


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