t view calls it 'objects'. The template name doesn't need to
be set up either, if you don't want to, it will default to
'/_list.html (or _detail.html)
-Mensaje original-
De: Soviet
Enviados: 08/07/2012 15:47:06
Asunto: Re: Problem with DetailView
Ha! Thank you and s
Ha! Thank you and sorry for my stupidity. I was confused by the fact that I
didn't had to do this in {for ... in ...}.
W dniu niedziela, 8 lipca 2012 19:05:17 UTC+2 użytkownik Tomas Neme napisał:
>
> Man...
>
> > (r'^sets/(?P\d+)/$', SetDetailView.as_view(
> > model=Set,
> > context_ob
Man...
> (r'^sets/(?P\d+)/$', SetDetailView.as_view(
> model=Set,
> context_object_name="set_details",
> template_name='data/set_details.html',
> )),
>
> But the site is empty. Here's my extremely simple template:
>
> {% block title %}{{ set.text_name }}{% endblock %}
>
> {% block
That's because of my example. I have a LEGO Set model:
class Set(models.Model):
lego_id = models.CharField(max_length=
32, primary_key=True, blank=True) #lego_id stores the unique number that's
on every Lego box
text_name = models.CharField(max_length=64)
#...
And I resolved my probl
That's because of my example. I have a LEGO Set model:
class Set(models.Model):
lego_id = models.CharField(max_length=32, primary_key=True, blank=True)
#lego_id stores the unique number that's on every Lego box
text_name = models.CharField(max_length=64)
#...
And I resolved my proble
> Turns out that's the problem. I wanted to use a field from my Car model:
> car_id, so the link on the website would look like:
> www.blablabla.com/cars/3421, where 3421 is the car_id. Unfortunately, the
> car_id is not the same as . Can I achieve something like that with class
what's car_id and
More data would be nice. What url are you goimg to that's failing, exactly? Are
you clicking a link from your ListView? If so, could you show your template?
-Mensaje original-
De: Soviet
Enviados: 07/07/2012 18:10:17
Asunto: Re: Problem with DetailView
But the ListView is wo
> Also, are you sure a car exists with the id / pk you're passing?
Turns out that's the problem. I wanted to use a field from my Car model:
car_id, so the link on the website would look like:
www.blablabla.com/cars/3421, where 3421 is the car_id. Unfortunately, the
car_id is not the same as .
Could you give us the fill error message displaying what ended up being
passed to the view?
Also, are you sure a car exists with the id / pk you're passing?
Le 7 juil. 2012 23:10, "Soviet" a écrit :
> But the ListView is working fine. And they don't use in the
> documentation, just this, which
But the ListView is working fine. And they don't use in the
documentation, just this, which I modified to fit my model:
urlpatterns = patterns('',
(r'^publishers/$', ListView.as_view(
model=Publisher,
)),
)
W dniu sobota, 7 lipca 2012 22:44:23 UTC+2 użytkownik Sam007 napisał:
>
On 07/07/2012 10:36 PM, Soviet wrote:
Now that I have basic understanding of models, I encountered even more
confusing subjects - views and urls. Now, the class-generic views are
quite easy to grasp at basic level, but I fail to understand what's
wrong with this code:
urlpatterns = patterns('
If I am not wrong. The issue is with the List View not Detail View.
You need to provide, List View with query set. If you are providing model
parameter, you will also need to give it a primary key 'pk', like you did
for Detail View.
Hope that helps,
Smaran
On Jul 7, 2012 3:36 PM, "Soviet" wrote:
12 matches
Mail list logo