Advertisement
Guest User

Eugenia

a guest
Nov 9th, 2010
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. # ------------------------------------------------------
  2. # ---------------------- views.py ----------------------
  3. # ------------------------------------------------------
  4.  
  5. # -*- coding: utf-8 -*-
  6. from django.contrib.auth.decorators import login_required
  7. from django.shortcuts import render_to_response
  8. from django.template import Context, RequestContext
  9.  
  10. @login_required
  11. def index(request):
  12.  
  13.     diccionario = {'login_logo':'banner_muestra.png',
  14.         'logo_description':'Banner de Muestra',
  15.         'username':'usuario',
  16.         'legend_footer':'Powered by Django-RecordStore'}
  17.  
  18.     return render_to_response('pos/index.html', diccionario)
  19.  
  20. # ACÁ ES DONDE HABÍA CREADO UN MÉTODO PARA LOGIN, IGUAL QUE index() PERO LLAMADO login_form()
  21.  
  22.  
  23.  
  24.  
  25. # ------------------------------------------------------
  26. # ---------------------- urls.py -----------------------
  27. # ------------------------------------------------------
  28.  
  29. # -*- coding: utf-8 -*-
  30. from django.conf import settings
  31. from django.conf.urls.defaults import *
  32. from django.contrib import admin
  33.  
  34. admin.autodiscover()
  35.  
  36. urlpatterns = patterns('',
  37.     (r'.*logout/$', 'django.contrib.auth.views.logout_then_login'),
  38.     (r'^admin/', include(admin.site.urls)),
  39.     (r'^/?$', 'pos.views.index'),
  40.     (r'pos/?$', 'pos.views.index'),
  41.     # ESTE LO DEJÉ ASÍ AHORA, PARA QUE ME FUNCIONE
  42.     (r'.*accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'registration/login.html'}),
  43.     (r'.*accounts/profile/$', 'pos.views.index'),
  44. )
  45.  
  46. # en produccion.
  47. if not settings.PRODUCCION:
  48.     urlpatterns += patterns('django.views',
  49.       (r'site_media/(.*)$', 'static.serve', {'document_root': settings.MEDIA_ROOT}),
  50.     )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement