A
A
Alexander Vinogradov2020-01-29 10:39:38
Django
Alexander Vinogradov, 2020-01-29 10:39:38

How to implement feedback processing API for django DRF?

Help me write a feedback form processing API view.
Previously, I made a view of the form arr in the usual way.
Task: get data, check, add to the database, send a letter.
At the same time, outsiders through api should not get data from the database, change or add.
Also, the nuance that the form is generated by VUE JS and what about the CRF token?

models.py

class Feedback(models.Model):
    """Данные обратной связи
    """
    name = models.CharField(max_length=50, blank=True, verbose_name='Имя')
    phone = models.CharField(max_length=50, verbose_name='Телефон')
    email = models.EmailField(max_length=50, blank=True, verbose_name='email')
    body = models.TextField(blank=True, verbose_name='Текст сообщения')


serializers.py

class FeedbackSerializers(ModelSerializer):

    class Meta:
        model = Feedback
        fields = '__all__'

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question