Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use app_name to ease namespace integration in project #511

Open
bastien34 opened this issue Jun 11, 2021 · 2 comments
Open

Use app_name to ease namespace integration in project #511

bastien34 opened this issue Jun 11, 2021 · 2 comments

Comments

@bastien34
Copy link

bastien34 commented Jun 11, 2021

Hi,
Maybe I misunderstand how django-scheduler should be implemented in my project. If I include urls.py in a sub namespace (as 'dashboard' in my case) I have these issue:

  • NoReverse Match issue when loading a page (as scheduler-list)
  • TemplateTags like prev_url(target, calendar, period) can't reverse either

So I have to include django-schedulers urls with a namespace:

In dashboard/urls.py

path('schedule/', include('schedule.urls', namespace='schedule')),

Wich force me to prepend all urls in template as following and to define app_name = 'schedule' in django_scheduler urls.py :

{% url "dashboard:schedule:schedule_list" %}

But this doesn't solve the templatetag issue as they can't reverse anyway the url without the correct namespace.

So what is the best solution to implement this app in a subapp? Wouldn't be a solution to create a new setting var like 'SCHEDULER_NAMESPACE' in settings and import it whenever a reverse operation is done in django-scheduler?

@bastien34 bastien34 changed the title Use app_name to ease integration in project using namespace Use app_name to ease namespace integration in project Jun 11, 2021
@MUDASSARHASHMI
Copy link

If you set up urls in project root your would do it like:
root.urls:
path('schedule/', include('schedule.urls', namespace='schedule')),

Then call it in template by "{% url 'schedule:schedule_list' %}". Not sure why would you say "dashboard" there. Might be complicated project settings but normally it works like I showed.

@xjlin0
Copy link
Contributor

xjlin0 commented Sep 12, 2022

Under root, putting the path include with namespace get me this error:

django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants