On Wed, Mar 11, 2009 at 10:34 PM, nixon66 <[email protected]> wrote:
>
> Here is the view, which works fine. Trying to write another that's
> similar but wanted to try out in shell first.
>
> def county_detail(request, county):
> c = County.objects.get(slug=county)
> Vendors = Vendor.objects.filter(county=c)
> return render_to_response('county/county_detail.html',{'county':c,
> 'Vendors': Vendors})
>
> On Mar 11, 11:28 pm, Alex Gaynor <[email protected]> wrote:
> > On Wed, Mar 11, 2009 at 10:26 PM, nixon66 <[email protected]> wrote:
> >
> > > Trying to test out something in the interactive shell as I write a
> > > view.
> >
> > > Tried this:
> >
> > > f = Country.objects.get(slug=county)
> >
> > > I'm getting a nameError saying name: "country" is not defined. I've
> > > imported the models so country should be there. I know there is
> > > something simple I'm missing just can't figure out what.
> >
> > What is county supposed to be here, perhaps you should paste the null
> view.
> >
> > Alex
> >
> > --
> > "I disapprove of what you say, but I will defend to the death your right
> to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
> >
>
Here the country parameter comes from the URL, in the shell you need to
either create a county variable or just use a string, or whatever else.
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---