Z
Z
zkweb2015-09-29 17:38:55
Django
zkweb, 2015-09-29 17:38:55

How to make the ForeignKey field (relationship) optional?

in the database there is a link one field is connected to another table with id
how to make it so that when adding a record you can both select something from the linking table and leave it empty if you don't need it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-09-29
@zkweb

sone_field = models.ForeignKey(SomeModel,blank = True, null = True)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question