hello guys, On clicking "*Click here to login* <http://localhost:8000/login/> " I was able to move my webpage to http://localhost:8000/login/ with
"from django.contrib.auth.views.login" by entering the username and password, I am getting below error. "AttributeError: 'Manager' object has no attribute 'games_for_user'" user/views.py contains: from tictactoe.models import Game @login_required def home(request): my_games = Game.objects.games_for_user(request.user) active_games = my_games.filter(status="A") finished_games = my_games.exclude(status="A") waiting_games = active_games.filter(next_to_move=request.user) other_games = active_games.exclude(next_to_move=request.user) context = {'other_games': other_games, 'waiting_games': waiting_games, 'finished_games': finished_games} return render(request, "user/home.html", context) So, Game is not getting imported with: from tictactoe.models import Game below is my directory tree: any help is appreciated. thanks Deepanshu On Wednesday, March 16, 2016 at 6:42:45 PM UTC+5:30, Deepanshu Sagar wrote: > Yes, I got that working, thanks. :) > > On Tuesday, March 15, 2016 at 7:54:02 PM UTC+5:30, Bruno Barbosa wrote: >> >> you forgot the function name auth_views.logout as a second parameter as >> mentioned above. >> >> try it: >> url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'}, >> name='boardgames_logout'), >> >> -- >> Bruno Barbosa >> Web Developer >> *brunobarbosa.com.br <http://brunobarbosa.com.br>* >> >> On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar <deepa...@gmail.com> >> wrote: >> >>> yes, thank you for the prompt reply, I am using >>> >>> from django.contrib.auth import views as auth_views >>> >>> I need to redirect my webpage to "board_games" main page when the user >>> logs out. >>> can you please direct me to the correct way to do that? >>> >>> Thanks in advance. >>> >>> >>> >>> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote: >>> >>>> You are correct, your problem is in logout url , because you need to >>>> pass a function not a duct as second parameter. >>>> >>>> Are you using django auth views ? >>>> >>>> >>>> >>>> https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout >>>> >>>> >>>> El martes, 15 de marzo de 2016, Deepanshu Sagar <deepa...@gmail.com> >>>> escribió: >>>> > Hello, >>>> > i am getting below error while accessing http://localhost:8000/login/ >>>> . >>>> > >>>> </mail/u/0/s/?view=att&th=1537a25505109f0c&attid=0.1&disp=emb&realattid=autoGeneratedInlineImage1&zw&atsh=1> >>>> > >>>> > Below are the chaining codes. >>>> > boardgames\urls.py >>>> > >>>> </mail/u/0/s/?view=att&th=1537a25505109f0c&attid=0.2&disp=emb&realattid=autoGeneratedInlineImage2&zw&atsh=1> >>>> > boardgames\templates\login.html >>>> > >>>> </mail/u/0/s/?view=att&th=1537a25505109f0c&attid=0.3&disp=emb&realattid=autoGeneratedInlineImage3&zw&atsh=1> >>>> > >>>> > NOTE: before adding " >>>> > >>>> > url(r'^logout/', {'next_page': 'boardgames_home'}, >>>> name='boardgames_logout') >>>> > >>>> > to boardgames\urls.py. the access was working fine. >>>> > below is the settings.py >>>> > >>>> > """ >>>> > Django settings for boardgames project. >>>> > >>>> > For more information on this file, see >>>> > https://docs.djangoproject.com/en/1.6/topics/settings/ >>>> > >>>> > For the full list of settings and their values, see >>>> > https://docs.djangopro ect.com/en/1.6/ref/settings/ >>>> > """ >>>> > >>>> > # Build paths inside the project like this: os.path.join(BASE_DIR, >>>> ...) >>>> > import os >>>> > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >>>> > >>>> > >>>> > # Quick-start development settings - unsuitable for production >>>> > # See >>>> https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ >>>> > >>>> > # SECURITY WARNING: keep the secret key used in production secret! >>>> > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v' >>>> > >>>> > # SECURITY WARNING: don't run with debug turned on in production! >>>> > DEBUG = True >>>> > >>>> > >>>> > ALLOWED_HOSTS = [] >>>> > >>>> > >>>> > # Application definition >>>> > >>>> > INSTALLED_APPS = ( >>>> > 'django.contrib.admin', >>>> > 'django.contrib.auth', >>>> > 'django.contrib.contenttypes', >>>> > 'django.contrib.sessions', >>>> > 'django.contrib.messages', >>>> > 'django.contrib.staticfiles', >>>> > 'main', >>>> > 'tictactoe', >>>> > ) >>>> > >>>> > MIDDLEWARE_CLASSES = ( >>>> > 'django.contrib.sessions.middleware.SessionMiddleware', >>>> > 'django.middleware.common.CommonMiddleware', >>>> > 'django.middleware.csrf.CsrfViewMiddleware', >>>> > 'django.contrib.auth.middleware.AuthenticationMiddleware', >>>> > 'django.contrib.messages.middleware.MessageMiddleware', >>>> > 'django.middleware.clickjacking.XFrameOptionsMiddleware', >>>> > ) >>>> > >>>> > ROOT_URLCONF = 'boardgames.urls' >>>> > >>>> > TEMPLATES = [ >>>> > { >>>> > 'BACKEND': 'django.template.backends.django.DjangoTemplates', >>>> > 'DIRS': [os.path.join(BASE_DIR, 'templates')], >>>> > 'APP_DIRS': True, >>>> > 'OPTIONS': { >>>> > 'context_processors': [ >>>> > 'django.core.context_processors.request', >>>> > 'django.template.context_processors.debug', >>>> > 'django.template.context_processors.request', >>>> > 'django.contrib.auth.context_processors.auth', >>>> > 'django.contrib.messages.context_processors.messages', >>>> > ], >>>> > }, >>>> > }, >>>> > ] >>>> > >>>> > >>>> > WSGI_APPLICATION = 'boardgames.wsgi.application' >>>> > >>>> > >>>> > # Database >>>> > # https://docs.djangoproject.com/en/1.6/ref/settings/#databases >>>> > >>>> > DATABASES = { >>>> > 'default': { >>>> > 'ENGINE': 'django.db.backends.sqlite3', >>>> > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), >>>> > } >>>> > } >>>> > >>>> > # Internationalization >>>> > # https://docs.djangoproject.com/en/1.6/topics/i18n/ >>>> > >>>> > LANGUAGE_CODE = 'en-us' >>>> > >>>> > TIME_ZONE = 'UTC' >>>> > >>>> > USE_I18N = True >>>> > >>>> > USE_L10N = True >>>> > >>>> > USE_TZ = True >>>> > >>>> > >>>> > # Static files (CSS, JavaScript, Images) >>>> > # https://docs.djangoproject.com/en/1.6/howto/static-files/ >>>> > >>>> > STATIC_URL = '/static/' >>>> > STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),) >>>> > >>>> > LOGIN_URL = 'boardgames_login' >>>> > LOGOUT_URL = 'boardgames_logout' >>>> > LOGIN_REDIRECT_URL = 'user_home' >>>> > >>>> > I am new to Django learning. >>>> > Please let me know if more details are required. >>>> > Regards >>>> > Deepanshu >>>> > >>>> > -- >>>> > 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. >>>> > To post to this group, send email to django...@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/28da63f3-382c-4ff8-b698-79bc0b0d8b49%40googlegroups.com >>>> . >>>> > For more options, visit https://groups.google.com/d/optout. >>>> > >>>> >>>> -- >>>> "La utopía sirve para caminar" Fernando Birri >>>> >>>> >>>> >>>> -- >>> 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. >>> To post to this group, send email to django...@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/d68b7556-ef42-44b6-8f14-897d44803931%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/django-users/d68b7556-ef42-44b6-8f14-897d44803931%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> 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/6b8ebf56-a8ad-4bb8-81a4-961be307414a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.