Search code examples
djangodjango-viewflow

Is Viewflow for superusers only?


I'm learning django viewflow (non-Pro) and the all processes that I've been creating works for superuser users only

Is that normal?

Thanks, José.-

Edit 2: My specific problem is that my user can start the process, but he can't continue it (can't see the "otro_paso" task. See the code below), only if he's not superuser. When I cnange him to superuser, works.. why??

Edit 1: I'm using django-material auto-generated forms

A way to make it work is implementing custom views, making the permission validation programmatically

Edit 3:

Here's the flows.py part:

@frontend.register
class Flujo_Proceso_Recursos_fisicos(Flow):
    process_class = Proceso_Recursos_fisicos
    process_title = 'Recursos físicos'
    process_description = 'Registro de recursos físicos'

    inicio = flow.Start(
        CreateProcessView,
        fields=['anio'],
        task_title='Iniciar'
    ).Available(
        username='jose'
    ).Permission(
        'helloworld.puede_participar_biblioteca'
    ).Next(this.otro_paso)

    otro_paso = flow.View(
        UpdateProcessView,
        fields=['campus'],
        task_title='Campus',
        task_description= "Completar campus",
    ).Permission(
        'helloworld.puede_participar_biblioteca'
    ).Assign(
        username='jose'
    ).Next(this.fin)

    fin = flow.End(
        task_title='Finalizado',
    )

Solution

  • To make a task available for a user, you need to auto-assign it with flow.View(..).Assign(...) or provide permission that would make this task available for a user - flow.View(..).Permission(..)

    For the reference, you can check the demos

    https://github.com/viewflow/viewflow/blob/master/demo/helloworld/flows.py#L42 https://github.com/viewflow/viewflow/blob/master/demo/shipment/flows.py#L28