I just wanted to report back and see if you had any additional ideas to 
offer. I did change the meta from id to pk, but there was no change. Then I 
took reverse off the template for loop and (almost) everything was the way 
I wanted it. For some reason, Article 4 came out Sections 3,4,1,2, in that 
order. Their ids, in that same order, are 16, 15, 13, 14. In other words, 
if they were ordered by pk like the rest, they would be in proper order, 
but they are not. Since it is only this one group, I don't want to mess 
with the whole thing anymore, but I don't know what to do about these. The 
only thing I can think of is to delete 3 and 4 and then re-create them and 
hope that puts them in the right order. Any other ideas?

I was wrong about the Articles and Sections on the same view. Turns out it 
was the ID that was controlling everything, Django wasn't even looking at 
the slug, even when I put unique_together on the meta. Changing the names 
of the Sections didn't even work. Neither did putting article_id in the 
Sections regex. If I put sectionView first in the urlconf, all the sections 
would come up fine but none of the articles. If I put articleView first in 
the urlconf, the articles all came up and the sections got doesnotexist. 
The only thing that worked (and I tried A LOT of variations) was to put the 
Sections on (?P<slug>) only, no id, no digits.

So even though that problem is technically solved, if you have some best 
practices to share with me so I can get this done better next time, I am 
all ears. 

Thanks again for all the help.

On Thursday, October 2, 2014 4:08:24 PM UTC-5, Malik Rumi wrote:
>
> Collin, 
> Thank you for the suggestion. I will try it tonight after I get off work 
> and can finish cleaning up the code following Daniel's answer. sectionView 
> is supposed to be id/slug, but I included the Article name in the Section 
> names, because I can't put a fk in the slug. So maybe that was also a newby 
> mistake. This must be why Django is sending Article 1 and Article 2 Section 
> 1 to the same view, it sees the match for 'Article' and stops there. So 
> I'll probably end up renaming them, so as you can see, I have (made for 
> myself) a lot of (re)work to do. But I am learning! 
>
> On Thursday, October 2, 2014 12:49:47 PM UTC-5, Collin Anderson wrote:
>>
>> For the ordering issue, I'd recommend setting ordering = ['pk'] in the 
>> Model class Meta, then you don't need to try to handle it in your view.
>>
>> What does your sectionView look like? Does /{{ id }}/{{ slug }}/ uniquely 
>> identify both an article and a section, or should it be /{{ article_id 
>> }}/{{ article_slug }}/{{ section_id }}/ ?
>>
>

-- 
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/75b7a838-6433-4cc8-a499-577b37245132%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to