dynamic-django-forms icon indicating copy to clipboard operation
dynamic-django-forms copied to clipboard

How to elaborate data on form sending

Open Mte90 opened this issue 3 years ago • 3 comments

I am trying to understand if I need to do a rest request after the form sending (with some data) how I can do using this package. Someone can help me? The readme just show how to show the data but not any elaboration on saving as example.

Mte90 avatar Feb 17 '22 10:02 Mte90

I tried adding in the formmodel:

    def save(self, *args, **kwargs):
        print(args)
        print(kwargs)
        return super().save(*args, **kwargs)

But the code isn't executed.

Mte90 avatar Feb 17 '22 11:02 Mte90

I was able to do it on the FormResponse:


from django.db.models.signals import pre_save
from django.dispatch import receiver

@receiver(pre_save, sender=FormResponse)
def create_slug(sender, instance, *args, **kwargs):
    print(args)
    print(kwargs)

Mte90 avatar Feb 17 '22 11:02 Mte90

Sorry for the late reply. just put this on the README (a bit too late, tbh), but I'm not using Django in any projects, and am open to someone else taking over maintenance of this package. I don't really have the time or need to push new features at the moment.

askvortsov1 avatar Apr 16 '23 19:04 askvortsov1