You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(user) always prints None and the restaurant drop-down menu (/items/create/) is totally blank. Why is this happening? Here's the code from my forms.py of menus app. I've logged in and logged out time again and checked the code multiple times. But I still end up with this.
from django import forms
from restaurants.models import RestaurantLocation`
from .models import Item
class ItemForm(forms.ModelForm):
class Meta:
model = Item
fields = [
'restaurant',
'name',
'contents',
'excludes',
'public'
]
def __init__(self, user=None, *args, **kwargs):
# print(kwargs.pop('user'))
print(user)
super(ItemForm, self).__init__(*args, **kwargs)
self.fields['restaurant'].queryset = RestaurantLocation.objects.filter(owner=user)
Django version 1.11.2, using settings 'muypicky.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK. None
[11/Jul/2018 16:00:23] "GET /items/create/ HTTP/1.1" 200 2309
Performing system checks...
The text was updated successfully, but these errors were encountered:
print(user) always prints None and the restaurant drop-down menu (/items/create/) is totally blank. Why is this happening? Here's the code from my forms.py of menus app. I've logged in and logged out time again and checked the code multiple times. But I still end up with this.
Django version 1.11.2, using settings 'muypicky.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
None
[11/Jul/2018 16:00:23] "GET /items/create/ HTTP/1.1" 200 2309
Performing system checks...
The text was updated successfully, but these errors were encountered: