Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django URL dispatcher help
#1
Need help with URLconf

The parameter can be a directory or a file name. For example:

gallery/Some/Directory/
gallery/SomeDirectory/
gallery/Some/Directory/In/Directory

Should go to: "views.gallery" with parameter folder: "Some/Directory" or "SomeDirectory" or "Some/Directory/In/Directory"

But if it ends with filename:

gallery/Some/Directory/photo123.jpg
gallery/SomeDirectory/photo432.jpg
gallery/Some/Directory/In/Directory/image343.jpg

Should go to: "views.photo" with parameter: folder: "Some/Directory" and filename: "photo123.jpg" and so on..

How I can configure this in urls.py ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,315 Jun-30-2019, 12:21 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020