Re: Class Base View Foreign key

2021-02-28 Thread Sky Lord
What's that, am new please On Sat, Feb 27, 2021, 4:47 PM Rob Wilkinson wrote: > This is what my code looks like and it now works : > > see where it says "example of setting pk..." below: > > def dyn_menu_new(request): > > from .models import menu as menuX > > from .models import buttons

Re: Class Base View Foreign key

2021-02-27 Thread Rob Wilkinson
This is what my code looks like and it now works : see where it says "example of setting pk..." below: def dyn_menu_new(request): from .models import menu as menuX from .models import buttons if request.method == 'POST': if request.user.is_superuser: super_user

Re: Class Base View Foreign key

2021-02-27 Thread sebasti...@gmail.com
Hey, thanks for you response. Before i save i want to make is_valid() and there came this exception. Regards wilkycon...@gmail.com schrieb am Samstag, 27. Februar 2021 um 16:36:35 UTC+1: > I had similar issues, I found this helpful: > > https://groups.google.com/g/django-users/c/PcSDKZhPVmc >

Re: Class Base View Foreign key

2021-02-27 Thread Rob Wilkinson
I had similar issues, I found this helpful: https://groups.google.com/g/django-users/c/PcSDKZhPVmc On Sat, Feb 27, 2021 at 9:19 AM Ryan Nowakowski wrote: > I think choices is causing the problem. Try limit_choices_to instead: > > > https://docs.djangoproject.com/en/dev/ref/models/fields/#djan

Re: Class Base View Foreign key

2021-02-27 Thread Ryan Nowakowski
I think choices is causing the problem. Try limit_choices_to instead: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to On February 27, 2021 8:06:26 AM CST, "sebasti...@gmail.com" wrote: >Hello, > >I have a CBV with Createview. Now i have a Fo

Class Base View Foreign key

2021-02-27 Thread sebasti...@gmail.com
Hello, I have a CBV with Createview. Now i have a Foreign Key from Box to Tabs model. When i submit request then i get error:* Cannot assign "1": "Box.tabs_link" must be a "Tabs" instance*. This happens on form.is_valid I understand this error but i don't know how can i fix this. *Models.py*: