Playlists = forms.ChoiceField(choices=())ĭef _init_(self, *args, request=None, **kwargs): Return render(request, 'show_playlist.html', )įorms.py class ChoosePlaylistForm(ModelForm): Messages.success(request, "Playlist successfully chosen")įorm = ChoosePlaylistForm(request=request) Return redirect('/members/account/' + )įorm = ChoosePlaylistForm(request.POST, request=request) Messages.error(request, "You're not authenticated with Spotify, please authenticate here") If not is_user_already_auth_spotify(request):
The only problem is that, for some reason, I got an IntegrityError error NOT NULL constraint failed: manager_er_idīelow my view, form and model in Django views.py def playlist(request): I now need, once the data is being submitted, to be save on the database. The data in the field are calculated on the go by the Form. I'm new to Django and I have built a Form that shows a single select field to chose from. Is this already bad practice or doable in some cases/not avoidable at some point? However, I have to execute some code twice.
#CONDA INSTALL XGBOOST HOW TO#
What I am trying to do is the following: await cur.execute("SELECT street, country FROM dbname WHERE user=%s AND user=%s", (user1, user2,)) I have a column with different stored data (user, street, country).