Browse Source

App Eventos - início do desenvolvimento.

stable/1.0
Sesostris Vieira 12 years ago
parent
commit
555d7bf56a
  1. 20
      .pydevproject
  2. 0
      sigi/apps/eventos/__init__.py
  3. 7
      sigi/apps/eventos/admin.py
  4. 28
      sigi/apps/eventos/models.py
  5. 23
      sigi/apps/eventos/tests.py
  6. 1
      sigi/apps/eventos/views.py
  7. 3
      sigi/sites.py

20
.pydevproject

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python 2.7 with django-1.2</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
@ -23,11 +21,13 @@
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>DJANGO_MANAGE_LOCATION</key>
<value>sigi/manage.py</value>
<key>sigi</key>
<value>/home/sesostris/workspace/sigi/sigi</value>
</pydev_variables_property>
<key>DJANGO_MANAGE_LOCATION</key>
<value>sigi/manage.py</value>
<key>sigi</key>
<value>/home/sesostris/workspace/sigi/sigi</value>
<key>DJANGO_SETTINGS_MODULE</key>
<value>sigi.settings</value>
</pydev_variables_property>

0
sigi/apps/eventos/__init__.py

7
sigi/apps/eventos/admin.py

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from django.contrib import admin
from sigi.apps.eventos.models import Recurso
class RecursoAdmin(admin.ModelAdmin):
list_display = ('nome', 'quantidade',)
pass

28
sigi/apps/eventos/models.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from django.db import models
class Recurso(models.Model):
nome = models.CharField(u'Nome', max_length=60)
descricao = models.TextField(u'Descrição', help_text = 'Descrição detalhada do recurso', blank=True)
quantidade = models.PositiveIntegerField(u'Quantidade', 'Quantidade disponível do recurso no Interlegis. Use 9999 para infinito')
class Meta:
verbose_name, verbose_name_plural = 'Recurso', 'Recursos'
def __unicode__(self):
return self.nome;
def qtde_disponivel(self, data_inicio, data_fim):
"""
Given a date range, return the available quantity of recourse in that period.
"""
#TODO: Write the code when Evento model is done
return self.quantidade
def reservar(self, evento, data_inicio, data_fim):
"""
Lock a quantity of resource to an 'evento' in timeslice between 'data_inicio' and 'data_fim'
Return True if successfull or False otherwise
"""
# TODO: Write code when Evento model is done
return True

23
sigi/apps/eventos/tests.py

@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

1
sigi/apps/eventos/views.py

@ -0,0 +1 @@
# Create your views here.

3
sigi/sites.py

@ -32,6 +32,7 @@ from sigi.apps.servidores.admin import (Servidor, ServidorAdmin, Funcao, FuncaoA
Ferias, FeriasAdmin, Licenca, LicencaAdmin)
from sigi.apps.ocorrencias.admin import (Ocorrencia, OcorrenciaAdmin, Anexo as AnexoOcorrencia,
AnexoAdmin as AnexoOcorrenciaAdmin, Categoria)
from sigi.apps.eventos.admin import (Recurso, RecursoAdmin)
class DefaultSite(AdminSite):
index_template = 'index.html'
@ -112,3 +113,5 @@ default.register(Ocorrencia, OcorrenciaAdmin)
default.register(AnexoOcorrencia, AnexoOcorrenciaAdmin)
default.register(Categoria)
# sigi.apps.eventos
default.register(Recurso, RecursoAdmin)

Loading…
Cancel
Save