diff options
Diffstat (limited to 'encuestas')
| -rw-r--r-- | encuestas/admin.py | 4 | ||||
| -rw-r--r-- | encuestas/models.py | 7 | ||||
| -rw-r--r-- | encuestas/urls.py | 12 | ||||
| -rw-r--r-- | encuestas/views.py | 12 | 
4 files changed, 19 insertions, 16 deletions
| diff --git a/encuestas/admin.py b/encuestas/admin.py index e298448..ae9f44e 100644 --- a/encuestas/admin.py +++ b/encuestas/admin.py @@ -1,6 +1,7 @@  # vim: set fileencoding=utf-8 ts=4 shiftwidth=4 softtabstop=4 expandtab:  from django.contrib import admin -from elgarito.encuestas.models import Encuesta, Respuesta, VotoUsuario +from encuestas.models import Encuesta, Respuesta, VotoUsuario +  class EncuestaAdmin(admin.ModelAdmin):      list_display = ( @@ -13,6 +14,7 @@ class EncuestaAdmin(admin.ModelAdmin):  admin.site.register(Encuesta, EncuestaAdmin) +  class RespuestaAdmin(admin.ModelAdmin):      list_display = (          'encuesta', diff --git a/encuestas/models.py b/encuestas/models.py index 8d54fef..c9d527b 100644 --- a/encuestas/models.py +++ b/encuestas/models.py @@ -1,10 +1,10 @@  # vim: set fileencoding=utf-8 ts=4 shiftwidth=4 softtabstop=4 expandtab:  from django.db import models  from django.contrib.auth.models import User -from django.contrib.auth.models import Group -from elgarito.tablon.models import Tema +from tablon.models import Tema  from django.forms import ModelForm +  class Encuesta(models.Model):      pregunta = models.CharField(max_length=200)      #descripcion @@ -16,13 +16,13 @@ class Encuesta(models.Model):      tema = models.ForeignKey(Tema)      #activa -      def __repr__(self):          return self.pregunta      def __unicode__(self):          return self.pregunta +  class EncuestaForm(ModelForm):      class Meta:          model = Encuesta @@ -45,6 +45,7 @@ class Respuesta(models.Model):      def ultimo_mensaje(self):          return self.mensaje_set.latest() +  class VotoUsuario(models.Model):      usuario = models.ForeignKey(User)      encuesta = models.ForeignKey(Encuesta) diff --git a/encuestas/urls.py b/encuestas/urls.py index ac2e286..b24e318 100644 --- a/encuestas/urls.py +++ b/encuestas/urls.py @@ -1,8 +1,10 @@ -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url -urlpatterns = patterns('elgarito.encuestas.views', -    (r'^$', 'index'), +urlpatterns = patterns( +    'encuestas.views', +     +    url(r'^$', 'index'), -    (r'^votar/(?P<foro_id>\d+)/$', 'votar'), -    (r'^ver/(?P<foro_id>\d+)/$', 'ver'), +    url(r'^votar/(?P<foro_id>\d+)/$', 'votar'), +    url(r'^ver/(?P<foro_id>\d+)/$', 'ver'),  ) diff --git a/encuestas/views.py b/encuestas/views.py index e013d1a..6108e39 100644 --- a/encuestas/views.py +++ b/encuestas/views.py @@ -1,11 +1,8 @@  # vim: set fileencoding=utf-8 ts=4 shiftwidth=4 softtabstop=4 expandtab: -from elgarito.encuestas.models import Encuesta -from django.contrib.auth.models import User -from django.shortcuts import render_to_response, get_object_or_404 +from encuestas.models import Encuesta +from django.shortcuts import render_to_response  from django.template import RequestContext -from django.http import HttpResponseRedirect -from django.contrib.auth.decorators import user_passes_test -from datetime import datetime +  def index(request):      lista_encuestas = Encuesta.objects.all() @@ -14,6 +11,7 @@ def index(request):                                    'lista_encuestas': lista_encuestas,                                })) +  def ver(request):      lista_encuestas = Encuesta.objects.all()      return render_to_response('encuestas/index.html', @@ -21,10 +19,10 @@ def ver(request):                                    'lista_encuestas': lista_encuestas,                                })) +  def votar(request):      lista_encuestas = Encuesta.objects.all()      return render_to_response('encuestas/index.html',                                RequestContext(request, {                                    'lista_encuestas': lista_encuestas,                                })) - | 
