Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

571
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda