Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
Django Intercambiando las URL anulando la parte de expresiones regulares

Al solicitar [GET] 127.0.0.1:8000/restaurant/1, obtengo un json limpio y un código de estado 200

 urlpatterns = [ url(r'^restaurant',views.Restaurant_List_Create.as_view(), name='all_restaurants'), url(r'^restaurant/(?P<pk>\d+)',views.Restaurant_Retrive.as_view(), name='specified_restaurant'), ]

pero cuando intercambio los códigos de URL, ejecuta views.Restaurant_List_Create.as_view () (anula la URL de expresiones regulares)

 urlpatterns = [ url(r'^restaurant/(?P<pk>\d+)',views.Restaurant_Retrive.as_view(), name='specified_restaurant'), url(r'^restaurant',views.Restaurant_List_Create.as_view(), name='all_restaurants'), ]
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Su URL coincide con ambas porque no ha incluido el signo $ al final de sus URL.

Puede cambiarlos de la siguiente manera:

 urlpatterns = [ url(r'^restaurant/(?P<pk>\d+)$',views.Restaurant_Retrive.as_view(), name='specified_restaurant'), url(r'^restaurant$',views.Restaurant_List_Create.as_view(), name='all_restaurants'), ]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!