Just import and use it.. On Thu, 10 Oct, 2019, 10:51 PM Shazia Nusrat, <shazianu...@gmail.com> wrote:
> ForeignKey. > > On Thu, Oct 10, 2019 at 9:18 AM Mohammad yunus <yunus...@gmail.com> wrote: > >> What is mean FK Shaziya >> >> On Thu, 10 Oct 2019, 9:19 pm Shazia Nusrat, <shazianu...@gmail.com> >> wrote: >> >>> Hi I have a situation to manage multiple models with FK for a single >>> CreateView. >>> >>> Can someone give me a solution for the below. >>> >>> class Client(models.Model): >>> name = models.CharField(max_length=100) >>> email = models.EmailField() >>> phone = models.CharField(max_length=100) >>> business = models.ForeignKey(Business, on_delete=models.CASCADE, >>> related_name = 'user_business') >>> contact = models.ForeignKey(Contact, >>> on_delete=models.CASCADE,related_name='client_contact') >>> class Business(models.Model): >>> name= models.CharField(max_length=100) >>> #some other fields >>> class Contact(models.Model): >>> #some fields >>> >>> >>> class ClientCreateView(CreateView): >>> # I need help to get related models in create view. Please >>> advise. >>> >>> >>> Help is much appreciated. >>> >>> Regards, >>> Shazia >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAD83tOy3%3DfE2ZM18E6MNTLE%2BOdsKY4F_de1rR-TGVsSy3%3DNU6w%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAD83tOy3%3DfE2ZM18E6MNTLE%2BOdsKY4F_de1rR-TGVsSy3%3DNU6w%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAEQiGcNtQwWgeBLZaLb%3DsToD6QRxFtm3Prv3Q2Lq9XaHONJ_XQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAEQiGcNtQwWgeBLZaLb%3DsToD6QRxFtm3Prv3Q2Lq9XaHONJ_XQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAD83tOxDdv7VBGhCJr%2BJ1fs66upZQxmVL6GPPV%2B%2B88v8z5HUGQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAD83tOxDdv7VBGhCJr%2BJ1fs66upZQxmVL6GPPV%2B%2B88v8z5HUGQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPjsHcHf%3Dc4R_ADVn9k%3DJaiLmL-ux2RqOwDMkRfb_9W%3DAqmtew%40mail.gmail.com.