[open-ils-commits] r7771 -
trunk/Open-ILS/admin/ils_admin/setup/ils_data
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 12 16:18:57 EDT 2007
Author: erickson
Date: 2007-09-12 16:11:05 -0400 (Wed, 12 Sep 2007)
New Revision: 7771
Modified:
trunk/Open-ILS/admin/ils_admin/setup/ils_data/models.py
Log:
added hours of operation model
Modified: trunk/Open-ILS/admin/ils_admin/setup/ils_data/models.py
===================================================================
--- trunk/Open-ILS/admin/ils_admin/setup/ils_data/models.py 2007-09-12 17:13:54 UTC (rev 7770)
+++ trunk/Open-ILS/admin/ils_admin/setup/ils_data/models.py 2007-09-12 20:11:05 UTC (rev 7771)
@@ -1,6 +1,7 @@
from django.db import models
from django.db.models import signals
from django.dispatch import dispatcher
+import datetime
INTERVAL_HELP_TEXT = _('examples: "1 hour", "14 days", "3 months", "DD:HH:MM:SS.ms"')
CHAR_MAXLEN=200 # just provide a sane default
@@ -10,23 +11,6 @@
Permission tables
-------------------------------------------------------------- """
-class GrpTree(models.Model):
- name = models.CharField(maxlength=100)
- parent_id = models.ForeignKey('self', null=True, related_name='children', db_column='parent')
- description = models.CharField(blank=True, maxlength=CHAR_MAXLEN)
- perm_interval = models.CharField(blank=True, maxlength=100, help_text=INTERVAL_HELP_TEXT)
- application_perm = models.CharField(blank=True, maxlength=100)
- usergroup = models.BooleanField()
- class Admin:
- list_display = ('name', 'description')
- list_filter = ['parent_id']
- search_fields = ['name', 'description']
- class Meta:
- db_table = 'grp_tree'
- ordering = ['name']
- verbose_name = _('User Group')
- def __str__(self):
- return self.name
class PermList(models.Model):
code = models.CharField(maxlength=100)
@@ -42,7 +26,7 @@
return self.code
class GrpPermMap(models.Model):
- grp_id = models.ForeignKey(GrpTree, db_column='grp')
+ grp_id = models.ForeignKey('GrpTree', db_column='grp')
perm_id = models.ForeignKey(PermList, db_column='perm')
depth_id = models.ForeignKey('OrgUnitType', to_field='depth', db_column='depth')
grantable = models.BooleanField()
@@ -56,9 +40,28 @@
def __str__(self):
return str(self.grp_id)+' -> '+str(self.perm_id)
+class GrpTree(models.Model):
+ name = models.CharField(maxlength=100)
+ parent_id = models.ForeignKey('self', null=True, related_name='children', db_column='parent')
+ description = models.CharField(blank=True, maxlength=CHAR_MAXLEN)
+ perm_interval = models.CharField(blank=True, maxlength=100, help_text=INTERVAL_HELP_TEXT)
+ application_perm = models.CharField(blank=True, maxlength=100)
+ usergroup = models.BooleanField()
+ class Admin:
+ list_display = ('name', 'description')
+ list_filter = ['parent_id']
+ search_fields = ['name', 'description']
+ class Meta:
+ db_table = 'grp_tree'
+ ordering = ['name']
+ verbose_name = _('User Group')
+ def __str__(self):
+ return self.name
+
+
""" There's no way to do user-based mangling given the size of the data without custom handling.
When you try to create a new permission map, it tries to load all users into a dropdown selector :(
@@ -184,8 +187,35 @@
def __str__(self):
return self.shortname
+class HoursOfOperation(models.Model):
+ #choices = tuple([ (datetime.time(i), str(i)) for i in range(0,23) ])
+ org_unit = models.ForeignKey('OrgUnit', db_column='id')
+ # XXX add better time widget support
+ dow_0_open = models.TimeField(_('Monday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_0_close = models.TimeField(_('Monday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_1_open = models.TimeField(_('Tuesday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_1_close = models.TimeField(_('Tuesday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_2_open = models.TimeField(_('Wednesday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_2_close = models.TimeField(_('Wednesday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_3_open = models.TimeField(_('Thursday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_3_close = models.TimeField(_('Thursday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_4_open = models.TimeField(_('Friday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_4_close = models.TimeField(_('Friday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_5_open = models.TimeField(_('Saturday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_5_close = models.TimeField(_('Saturday Close'), null=False, blank=False, default=datetime.time(17))
+ dow_6_open = models.TimeField(_('Sunday Open'), null=False, blank=False, default=datetime.time(9))
+ dow_6_close = models.TimeField(_('Sunday Close'), null=False, blank=False, default=datetime.time(17))
+ class Admin:
+ pass
+ class Meta:
+ db_table = 'hours_of_operation'
+ verbose_name = _('Hours of Operation')
+ verbose_name_plural = verbose_name
+ def __str__(self):
+ return str(self.org_unit)
+
""" --------------------------------------------------------------
Config tables
-------------------------------------------------------------- """
More information about the open-ils-commits
mailing list