I have a CreateView in which i want to access the type(choice field) of foreign key in my model which is being used in my current model.
Class Mymodel1(models.Model):
name = models.CharField()
type = models.CharField(choices=SomeTypes.choices())
Class MyModel2(models.Model):
name = models.CharField()
cas = models.ForeignKey(Mymodel1)
Class Mymodel2CreateView(models.Model):
pk_url_kwargs = 'cas_id'
def get_context_data(self):
type = *queryset to access type from model1*