This file contains hidden or 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
| function get_short_commit { | |
| git log -n 1 --format=oneline --abbrev-commit 2> /dev/null | sed -e 's/\([0-9a-f]*\)\(.*\)/\1/' | |
| } | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1 $(get_short_commit)]$(parse_git_dirty)/" | |
| } |
This file contains hidden or 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
| import logging | |
| from django import http | |
| from apikey.models import ApiKey | |
| def apikey_authorization(view): | |
| def new_view(request, *args, **kwargs): | |
| key_pair = request.META.get('HTTP_X_API') |
This file contains hidden or 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
| def login_forms(request): | |
| if not request.user.is_authenticated(): | |
| return { | |
| 'registration_form': RegistrationForm(), | |
| 'authentication_form': AuthenticationForm(), | |
| } | |
| return {} |
This file contains hidden or 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
| To install node.js and coffee-script inside a virtualenv and keep it self-contained: | |
| 1. Activate the virtualenv:: | |
| $ workon test | |
| 2. Move inside the virtualenv directory:: | |
| (test)$ cdvirtualenv |
This file contains hidden or 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
| >>> import urllib2 | |
| >>> from BeautifulSoup import BeautifulSoup | |
| >>> DATA_STRING = 'origen=p&szEstConsulta=OK&calle=%(street)s&numero=%(number)s&comuna=%(commune)s' | |
| >>> URL_STRING = 'http://codigopostal.correos.cl/correos_cp/soporte_web/consulta_web/versionphp2006/' \ | |
| ... 'pagina_interior/codigo_postal/Correos_codigoPostal_NEW/pgn_modulo_codigopostal.asp' | |
| >>> params = {'number': '229', 'commune': 'providencia', 'street': 'providencia'} # Urban Station | |
| >>> data = (DATA_STRING % params).replace(' ', '+') | |
| >>> page = urllib2.urlopen(URL_STRING, data) | |
| >>> soup = BeautifulSoup(page) |
This file contains hidden or 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
| {% load i18n %} | |
| <form method="post" | |
| {% if action_url %}action="{{ action_url }}"{%endif %} | |
| {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}> | |
| {% csrf_token %} | |
| <fieldset> | |
| {% if form_legend %} | |
| <legend>{% trans form_legend noop %}</legend> | |
| {% endif %}{# form_legend #} |
This file contains hidden or 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
| {% extends 'elections/base_edits.html' %} | |
| {% load i18n %} | |
| {% block content %} | |
| <div class="fondo_formulario"> | |
| <div class="numero_off uno">1.</div> | |
| <div class="numero_off dos"> | |
| <a href="{% url candidate_create election_slug=election.slug %}">2.</a> | |
| </div> |
NewerOlder