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

Longclaw urls clash with Wagtail urls #236

Open
jghyllebert opened this issue Apr 25, 2019 · 4 comments
Open

Longclaw urls clash with Wagtail urls #236

jghyllebert opened this issue Apr 25, 2019 · 4 comments

Comments

@jghyllebert
Copy link
Contributor

Versions

  • longclaw version: 1.0.2
  • Django version: 2.1.6
  • Python version: 3.7.3
  • Wagtail Version: 3.4

Description

In the Wagtail admin I created a Basket Page, with the slug checkout.
Upon requesting /en/checkout/ (I'm using wagtailtrans, hence the prepended language) I get a TemplateError.

TemplateDoesNotExist at /en/checkout/

checkout/checkout.html

Because it's trying to load CheckoutView from the checkout app in Longclaw.

This is resolved by switching the url positions

urlpatterns = [
    # ...
    path('', include(wagtail_urls)),
    path('', include(longclaw_urls)),
]

But then none of the api endpoints in Longclaw work.

as indicated in #235, I'm trying to implement Longclaw in an existing project. So I might have missed something.

@JamesRamm JamesRamm added this to the 1.1 Release milestone Apr 28, 2019
@JamesRamm
Copy link
Collaborator

If you create the checkout.html template, does this solve your problem? As mentioned here:
https://jamesramm.github.io/longclaw/docs/guide/checkout and also in the tutorial:
https://jamesramm.github.io/longclaw/docs/tutorial/checkout

@jghyllebert
Copy link
Contributor Author

May be I should've mentioned that the page type was not called Checkout, but Basket.

The problem is that because longclaw urls are before the ones of wagtail, the path '/en/checkout' was caught in Longclaw, while it should've been passed on to Wagtail.

@JamesRamm
Copy link
Collaborator

JamesRamm commented Sep 22, 2019

@jghyllebert
You are saying you are trying to create your own page with the same url as one existing in longclaw? (checkout).
This won't work since, as you found out, longclaw is already defining the 'checkout' url.
You can opt to not include the checkout urls of longclw by selectively including urls as here:
https://github.com/JamesRamm/longclaw/blob/master/longclaw/urls.py

But since checkout is a key functionality of longclaw (it being an e-commerce app) I'm not sure why you would want to do this.

Maybe if you explain your use case with regards to wanting to create your own 'checkout' slug, we can create a more targetted issue.

@thenewguy
Copy link
Collaborator

Did you try something like:

urlpatterns = [
    # ...
    path('store/', include(longclaw_urls)),
    path('cms/', include(wagtail_urls)),
]

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

No branches or pull requests

3 participants