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
// Tacit, Wrist mounted tactile feedback for the blind. | |
// By Steve Hoefer at Grathio Labs (http://grathio.com) | |
// Version 12.02.04 | |
// | |
// Copyright (c) 2012 Steve Hoefer | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | |
// associated documentation files (the "Software"), to deal in the Software without restriction, | |
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
// subject to the following conditions: |
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
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acad="http://academico.espoch.edu.ec/"> | |
<soapenv:Header> | |
<acad:credentials> | |
<!--Optional:--> | |
<acad:username>user</acad:username> | |
<!--Optional:--> | |
<acad:password>password</acad:password> | |
</acad:credentials> | |
</soapenv:Header> | |
<soapenv:Body> |
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 clean_cedula(self): | |
""" | |
Valída que sea Correcta la Cédula | |
""" | |
ced = self.cleaned_data['cedula'] | |
msg = "La Cédula introducida no es válida" | |
valores = [ int(ced[x]) * (2 - x % 2) for x in range(9) ] | |
suma = sum(map(lambda x: x > 9 and x - 9 or x, valores)) | |
veri = 10 - (suma - (10 * (suma / 10))) | |
if int(ced[9]) == int(str(veri)[-1:]): |
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 reclutar(nick): | |
print "Hola "+nick+", vente a la Orden. Serás bienvenido" | |
reclutar("Nox") |
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
class Knowledge(models.Model): | |
center = models.ForeignKey(Center) | |
group_type_choices = ( | |
('0', 'Niños'), | |
('1', 'Adultos'), | |
('2', 'Adultos Mayores'), | |
('4', 'Niños y Adultos'), | |
('5', 'Niños y Adultos Mayores'), | |
('6', 'Adultos y Adultos Mayores'), |
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
class KnowledgePollForm(forms.Form): | |
group_type = forms.ModelMultipleChoiceField(widget=forms.SelectMultiple, | |
queryset=GroupTypeForKnowledge.objects.all(), label='Grupo de Personas', required=True) | |
money_per_people = forms.DecimalField(max_digits=8, decimal_places=2, min_value=0, required=True, | |
label='Dinero máximo por persona') | |
activity = forms.ModelMultipleChoiceField(widget=forms.SelectMultiple, | |
queryset=ActivityForKnowledge.objects.all(), required=True, | |
label='Actividades que desea desarrollar') | |
transport = forms.ModelMultipleChoiceField(widget=forms.SelectMultiple, queryset=TransportForKnowledge.objects.all(), required=True, | |
label='Método de transporte preferido') |
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
class User(models.Model): | |
user = models.OneToOneField(Usuario, related_name='profile') | |
has_add_center = models.BooleanField(default=False) | |
reason_to_validate = models.TextField(blank=True) | |
def __str__(self): | |
return self.user.get_full_name() | |
class Meta: | |
permissions = ( |
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
class UpdateKnowledge(PermissionRequiredMixin, UpdateView): | |
permission_required = "usuario.add_center" | |
model = Knowledge | |
template_name = "knowledge_update.html" | |
form_class = KnowledgeCreate | |
def get(self, request, *args, **kwargs): | |
form = self.form_class(initial=self.initial) | |
try: |
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
#Update | |
def dispatch(self, request, *args, **kwargs): | |
if not Knowledge.objects.filter(center=request.user.profile.center).exists(): | |
return HttpResponseRedirect(reverse_lazy('Center:knowledge_create')) | |
else: | |
return super(UpdateKnowledge, self).dispatch(request, *args, **kwargs) | |
#Create |
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
class CenterTestCase(TestCase): | |
def setUp(self): | |
user = User.objects.create( | |
username='juliohurtado', | |
first_name="Julio", | |
last_name='Hurtado', | |
email='[email protected]', | |
is_active=True, | |
password='examplePass' | |
) |
OlderNewer