Z
Z
zelsky2015-09-24 23:54:24
Django
zelsky, 2015-09-24 23:54:24

Based url views django?

I'm thinking of using django-bootstrap-breadcrumbs, but I just can't figure out how to get the url for the section, for example, only from the view. One of the first projects can be said completely.

def all_rozdil(request,is_main):
    foo = []
    for name_part in NamePart.objects.all():
        foo.append({'name_part': name_part,'rozdils': Rozdil.objects.filter(part_of=name_part.pk)})
    stats = Stats.objects.all().filter(main_is_id=is_main)
    rozdil = Rozdil.objects.all()
    title_rozdil = Rozdil.objects.get(pk=is_main)
    context = {'stats':stats,'rozdil': rozdil,'title_rozdil':title_rozdil , 'foo': foo }

    def get_absolute_url(self):
        return "/rozdil/%i/" % self.id

    return render(request,'stats.html',context)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-09-25
@zelsky

get abs url must be written in the model
https://docs.djangoproject.com/en/1.8/ref/models/i...
бреадкрамбс стоит писать в зависимости от того как у тебя устроено иерархия на сайте

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question