m2m through problem: object has no attribute 'ce_set'

2012-07-13 Thread bn
I'm trying to get a template to iterate through and print intermediate 
model data.  Can you look at this and point out what is wrong?  I've tried 
to follow the django docs closely:

def category_detail(request, pk):
category= models.Category.objects.select_related().get(pk=pk)
entries = 
category.entry.order_by('-temp_sort_order').filter(temp_sort_order__gte=0)
for entry in entries:
assert isinstance(entry, models.Entry)

ce = models.CategoryEntry2.objects.get(entry=entry, 
category=category)
pprint('1: ' + ce.wiki + str(entry.ce))# works perfectly

#foo = entry.ce_set.get(category=category) #'Entry' object has no 
attribute 'ce_set'
#pprint('2: ' + foo.wiki + str(foo.ce))  #'Entry' object has no 
attribute 'ce_set'
for entry in category.ce_set.all:   #'Category' object has no 
attribute 'ce_set'
assert isinstance(entry, models.Entry)
pprint('1: ' + entry.wiki)

return render_to_response('category.html'...)

The Category model has a related_name of 'ce'.:

class Category(models.Model):
title   = models.CharField(max_length=1024,null=True,blank=True)
entry   = models.ManyToManyField(Entry,null=True,blank=True,
 related_name='ce',
 through='CategoryEntry2',
 )



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OHaEVYtohSYJ.
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.



Seeking chat or chaterbox module for use on django project

2014-05-04 Thread bn
I'm referencing:
https://groups.google.com/d/msg/django-users/Jp5qM-HEeOg/YUNjy8qBnPUJ
And
https://www.djangopackages.com/grids/g/chat/

Seeking a multiuser chat or chatterbox for a django project.  Meaning, a 
frame visitors can type into, and send a message to other users also 
viewing a site page.  Logged in users should adopt their django username, 
and visitors would be represented by an IP address.

I've worked through various options from 
https://groups.google.com/d/msg/django-users/Jp5qM-HEeOg/YUNjy8qBnPUJ and
found a lot of broken code, missing basic documentation, modules that poll 
constantly, and modules using django features deprecated several revisions 
back (and thus won't work on my django 1.5 base).

Is there a good standard solution, that more or less drops in?
That uses coment or ajax push?

Gnotty seems OK, but I don't have an IRC server, nor do I want users to 
register twice to chat.
https://www.djangopackages.com/packages/p/gnotty/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79bd6f21-5118-48b2-9f03-166641fbc206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.