Django - display static content based on url

I am working on a Django site with a basic three-column design. Left column navigation, central column content, and content blocks with a specific URL column.

My question is about the best method for managing blocks of content with a specific URL in the right column.

I am thinking of something according to the Flatpages suggestion, which will make the content available to the template context if the URL matches a predefined template (maybe a regular expression?).

Does anyone know if such an application exists?

If not, I'm looking for some tips on the best way to implement it. In particular with regard to matching patterns with the current URL. Is there a good way to reuse the parts of the Django URL Manager for this use?

+3
source share
3 answers

Django CMS is a good offer, it depends on how deep you want to go. If this is just the beginning of the different types of dynamic content you want, you should go that way.

A simple one-time solution would be something like this:

URL-, , . , , .

www.example.com/content/sidecontent/jokes/

, "" sidecontent ( ), urls.py

(r'^content/sidecontent/(?P<side>)/$,sides.views.showsides),

def showsides(request, side):
    Sides.objects.get(pk=side)

....

+1

- Django CMS. .

Django CMS , . . , . -, .

+1

Although Django-CMS is an interesting proposal, there are quite a few projects that specifically do what you requested - display blocks of content based on the URL. The main one I know about is django-flatblocks .

0
source

Source: https://habr.com/ru/post/1742603/


All Articles