Re: newbie - query not working!! Help please!!

2010-03-07 Thread uthaman
Yeah, I didn't display the entire view.  Sorry about that!  But, just
now I did figure out what I was doing wrong!  I named the variable
coming from the url "poll".  Which is the same as my class name
"Poll".  When I changed the url name to "id" everything magically
worked!  I feel like an idiot... lol.

Thanks to everyone who hosts their code on github!  I have spent the
last day pouring over code out there to try and figure out my
problem.  I actually figured it out looking thru Pinax.  Once I get my
little test site up and running I plan on checking that project out!

Thanks again!

On Mar 7, 7:09 am, Kev Dwyer  wrote:
> On Sat, 06 Mar 2010 09:52:06 -0800, uthaman wrote:
> > url:
> >    url(r'top25/(?P\d{1})/$', views.top25_test, name='top25_test'),
>
> > view:
> >         def top25_test(request, poll):
> >          entry = Poll.objects.filter(poll_id=poll)
>
> > model:
> > class Poll(models.Model):
> >    PUBLISHED_STATUS = 1
> >    DARK_STATUS = 2
> >    STATUS_CHOICES = (
> >            (PUBLISHED_STATUS, 'Published'),
> >            (DARK_STATUS, 'Dark'),
> >    )
> >    poll_id = models.AutoField(primary_key=True)
>
> > My problem is that this query returns nothing when I KNOW there is a
> > record there!  The url I am using is "/top25/1/".  I have tried the
> > django-debug-toolbar, but for some reason it does not debug the query.
> > Aargh!
>
> Hello,
>
> Your view doesn't seem to return anything - generally, it should to return an
> HttpResponse object.  Review part three of the Django tutorial.
>
> Cheers,
>
> Kev

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: newbie - query not working!! Help please!!

2010-03-07 Thread Kev Dwyer
On Sat, 06 Mar 2010 09:52:06 -0800, uthaman wrote:

> url:
>   url(r'top25/(?P\d{1})/$', views.top25_test, name='top25_test'),
> 
> view:
> def top25_test(request, poll):
> entry = Poll.objects.filter(poll_id=poll)
> 
> model:
> class Poll(models.Model):
>   PUBLISHED_STATUS = 1
>   DARK_STATUS = 2
>   STATUS_CHOICES = (
>   (PUBLISHED_STATUS, 'Published'),
>   (DARK_STATUS, 'Dark'),
>   )
>   poll_id = models.AutoField(primary_key=True)
> 
> My problem is that this query returns nothing when I KNOW there is a
> record there!  The url I am using is "/top25/1/".  I have tried the
> django-debug-toolbar, but for some reason it does not debug the query. 
> Aargh!


Hello,

Your view doesn't seem to return anything - generally, it should to return an 
HttpResponse object.  Review part three of the Django tutorial.

Cheers,

Kev

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



newbie - query not working!! Help please!!

2010-03-06 Thread uthaman
url:
url(r'top25/(?P\d{1})/$', views.top25_test, name='top25_test'),

view:
def top25_test(request, poll):
  entry = Poll.objects.filter(poll_id=poll)

model:
class Poll(models.Model):
PUBLISHED_STATUS = 1
DARK_STATUS = 2
STATUS_CHOICES = (
(PUBLISHED_STATUS, 'Published'),
(DARK_STATUS, 'Dark'),
)
poll_id = models.AutoField(primary_key=True)

My problem is that this query returns nothing when I KNOW there is a
record there!  The url I am using is "/top25/1/".  I have tried the
django-debug-toolbar, but for some reason it does not debug the
query.  Aargh!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.