Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

563
Visualizações
How to access a Django UpdateView with using a uuid as slug

I'm wondering on how I can access a UpdateView by using a uuid as slug. So my goal is an URL like

http://myapp.example.de/edit/7efdbb03-bdcf-4b8a-85dd-eb96ac9954fd

I have defined the the view like this:

class DeviceEventUploadView(UpdateView):

    model = Event
    slug_url_kwarg = 'uuid_slug'
    slug_field = 'unique_id' 

and urls.py like this:


urlpatterns = [
    path('admin/', admin.site.urls),
    path('edit/<uuid:uuid_slug>',
        DeviceEventUploadView.as_view(),
        name='event_update'),
]

Here I'm getting:


Using the URLconf defined in myproject.urls, Django tried these URL patterns, in this order:

    admin/
    ^edit/<uuid:uuid_slug> [name='event_update']

The current path, edit/7efdbb03-bdcf-4b8a-85dd-eb96ac9954fd/, didn’t match any of these.

Where is my failure in thinking?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You forgot to close the <uuid:uuid_slug>. It needs a closing angle bracket >. Furthermore this is path syntax. You thus define this with:

path(
    'edit/<uuid:uuid_slug>/',
    DeviceEventUploadView.as_view(),
    name='event_update'
),
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda