B
B
blackbb2017-08-03 16:59:43
Django
blackbb, 2017-08-03 16:59:43

How to pass form data to the next page?

Hello. There is a Master model:

class Master(models.Model):
    fio = models.CharField(max_length=300, verbose_name='ФИО')
    phone = models.CharField(max_length=12, verbose_name='Телефон')
    city = models.ManyToManyField(City, verbose_name='Город')
    profession = models.ForeignKey(Profession, verbose_name='Профессия')
    work = models.ManyToManyField(Work, verbose_name='Виды работ')

And there is an Order model:
class Order(models.Model):
    city = models.ManyToManyField(City, verbose_name='Город')
    work = models.ManyToManyField(Work, verbose_name='Виды работ')
    description = models.TextField(verbose_name='Примечания')
    master_send_sms = models.ManyToManyField(Master, blank=True, verbose_name='Кому отправить СМС')

Now, when creating an order, all fields are displayed except master_send_sms. The task is such that when creating an order, by clicking on the "Add" button, it will transfer to another page where I can select masters (which I will write down later in 'master_send_sms') from the city specified when creating the order. I just did it this way, success_url assigned the path 'send_master' and so the path function works that outputs the masters. So the question is how to pass the 'city' and 'work' data from the previous page into this function? Since the masters need to be filtered by them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilyas, 2017-08-03
@id2669099

and what prevents you from getting the form values ​​in the view on the send_master url and after that already generating the data for the new form?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question