Its the reverse. If the owner is deleted, all the cats and dogs associated 
with the owner will be deleted.

On Sunday, 28 January 2018 10:43:54 UTC+5:30, tangoward15 wrote:
>
> Will try it now. 
>
> Quesion about the on_delete=models.CASCADE, does this mean that if I 
> delete the pet (dog or cat) it will delete the owner who owns them?
>
> On Sun, Jan 28, 2018 at 1:11 PM, Akhil Lawrence <akhilp...@gmail.com 
> <javascript:>> wrote:
>
>> Your create view do not accept owner as a input and according to your 
>> models, owner can be null. That's the problem. Include owner to your create 
>> view fields as shown below. Also you may consider making owner mandatory as 
>> mentioned in my previous response.
>>
>>
>> class CreateDog(CreateView):
>>     model = Dog
>>     fields = ('name', 'bday', 'owner')
>>     template_name = 'animals/dog_create.html'
>>
>>
>> class CreateCat(CreateView):
>>     model = Cat
>>     fields = ('name', 'bday', 'owner')
>>     template_name = 'animals/cat_create.html'
>>
>> Thanks
>>
>> --
>> 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...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/340fa5fd-1475-4355-821c-82404b71b6bb%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/09d7c9ca-7dab-4787-94d9-09b3a1bc682a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to