Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding first version of the backend for citizen
- Loading branch information
Felipe Álvarez
committed
Apr 1, 2016
1 parent
828e7e6
commit 5dfc771
Showing
12 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class BackendCitizenConfig(AppConfig): | ||
name = 'backend_citizen' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models | ||
|
||
# Create your models here. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# coding=utf-8 | ||
from django.core.urlresolvers import reverse | ||
from elections.tests import VotaInteligenteTestCase as TestCase | ||
from django.contrib.auth.models import User | ||
from popular_proposal.models import ProposalTemporaryData, PopularProposal | ||
|
||
|
||
PASSWORD = 'perrito' | ||
|
||
|
||
class BackendCitizenViewsTests(TestCase): | ||
def setUp(self): | ||
super(BackendCitizenViewsTests, self).setUp() | ||
self.fiera = User.objects.get(username='fiera') | ||
self.fiera.set_password(PASSWORD) | ||
self.fiera.save() | ||
|
||
def test_my_profile_view(self): | ||
url = reverse('backend_citizen:index') | ||
response = self.client.get(url) | ||
self.assertRedirects(response, reverse('auth_login')+"?next="+url) | ||
self.client.login(username=self.fiera.username, password=PASSWORD) | ||
response = self.client.get(url) | ||
self.assertTemplateUsed(response, 'backend_citizen/index.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.conf.urls import patterns, url | ||
from backend_citizen.views import IndexView | ||
|
||
urlpatterns = patterns('', | ||
url(r'^index/?$', | ||
IndexView.as_view(), | ||
name='index'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.shortcuts import render | ||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
from django.views.generic.base import TemplateView | ||
|
||
|
||
class IndexView(LoginRequiredMixin, TemplateView): | ||
template_name='backend_citizen/index.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{% extends "base.html" %} | ||
{% load staticfiles %} | ||
{% load i18n %} | ||
{% load thumbnail %} | ||
{% load bootstrap_tags %} | ||
{% block extrajs %} | ||
{% endblock extrajs %} | ||
|
||
{% block content %} | ||
<!-- ModalCommentsForAProposal --> | ||
<div class="modal fade loadFromUrl" id="proposalComments" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title" id="myModalLabel">{% trans 'Actualiza los comentarios' %}</h4> | ||
</div> | ||
<div class="modal-body"> | ||
... | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<!-- Modal ModerateProposal --> | ||
<div class="modal fade loadFromUrl" id="moderateProposal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title" id="myModalLabel">{% trans '¿Deseas aceptar Propuesta Popular?' %}</h4> | ||
</div> | ||
<div class="modal-body"> | ||
... | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | ||
<script type="text/javascript" src="{% static 'js/jquery.gridAccordion.min.js' %}"></script> | ||
<!-- Featured Elections --> | ||
<div class="contenedorDestacado fondo-blanco"> | ||
<h1>{% blocktrans %}¡Bienvenid@ {{user}}!{% endblocktrans %}</h1> | ||
|
||
</div> | ||
<script> | ||
$(function(){ | ||
$('.loadFromUrl').on('show.bs.modal', function (event) { | ||
var anchor = $(event.relatedTarget) // Button that triggered the modal | ||
var modal = $(this) | ||
var body = modal.find('.modal-body'); | ||
body.load(anchor.data('url')); | ||
}) | ||
}); | ||
</script> | ||
{% endblock content %} | ||
|
||
{% block extrafooter %} | ||
{% endblock extrafooter %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters