geopuzzle icon indicating copy to clipboard operation
geopuzzle copied to clipboard

Use namespaces for urls

Open TyVik opened this issue 3 years ago • 5 comments

Refactor

    path('<name>/questions/', PuzzleQuestionView.as_view(), name='puzzle_questions'),

to

    path('puzzle/', include('puzzle.urls', namespace='puzzle')),
    path('<name>/questions/', PuzzleQuestionView.as_view(), name='questions'),

TyVik avatar Oct 14 '21 18:10 TyVik

Can I work on this issue?

aadityasinha-dotcom avatar Oct 15 '21 06:10 aadityasinha-dotcom

yep, sure :) it should be easy

TyVik avatar Oct 15 '21 07:10 TyVik

yep, sure :) it should be easy

Assign me please.

aadityasinha-dotcom avatar Oct 15 '21 07:10 aadityasinha-dotcom

@TyVik can you explain me a little bit.

aadityasinha-dotcom avatar Oct 15 '21 08:10 aadityasinha-dotcom

The main things - use https://docs.djangoproject.com/en/3.2/topics/http/urls/#url-namespaces.

I have 2 places for that - puzzle/ and quiz/ in https://github.com/TyVik/geopuzzle/blob/develop/mercator/urls.py#L39. Just:

  • add namespace in include
  • update the linked urls.py
  • special case in https://github.com/TyVik/geopuzzle/blob/a33eeaf2ce04b24cc5160c6f4444fb1910e3fdc7/maps/models/game.py#L49
  • update tests

TyVik avatar Oct 15 '21 10:10 TyVik