Django pre-filling data in form from URL
问题 So i have a button on my detailView page for my model 'patient', and that takes you to a createView for my other model 'appointment'. What i want is the foreign key field of the appointment to be pre-filled depending on what detailView i come from. Here is my code so far: urls.py: # /patients/appointment/add url(r'appointment/add/$', views.appointmentCreate.as_view(), name='appointment-create'), models.py: class patient(models.Model): TITLE_CHOICES = ( ('Mr', 'Mr'), ('Mrs', 'Mrs'), ('Ms', 'Ms