summaryrefslogtreecommitdiff
path: root/archaeological_warehouse
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r--archaeological_warehouse/__init__.py0
-rw-r--r--archaeological_warehouse/migrations/0001_initial.py229
-rw-r--r--archaeological_warehouse/migrations/__init__.py0
-rw-r--r--archaeological_warehouse/models.py82
4 files changed, 311 insertions, 0 deletions
diff --git a/archaeological_warehouse/__init__.py b/archaeological_warehouse/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_warehouse/__init__.py
diff --git a/archaeological_warehouse/migrations/0001_initial.py b/archaeological_warehouse/migrations/0001_initial.py
new file mode 100644
index 000000000..6c3b14e75
--- /dev/null
+++ b/archaeological_warehouse/migrations/0001_initial.py
@@ -0,0 +1,229 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'WarehouseType'
+ db.create_table('archaeological_warehouse_warehousetype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['WarehouseType'])
+
+ # Adding model 'Warehouse'
+ db.create_table('archaeological_warehouse_warehouse', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=40)),
+ ('warehouse_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.WarehouseType'])),
+ ('person_in_charge', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], null=True, blank=True)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['Warehouse'])
+
+ # Adding model 'ContainerType'
+ db.create_table('archaeological_warehouse_containertype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ('length', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('width', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('height', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('volume', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('reference', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['ContainerType'])
+
+ # Adding model 'Container'
+ db.create_table('archaeological_warehouse_container', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('location', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.Warehouse'])),
+ ('container_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.ContainerType'])),
+ ('reference', self.gf('django.db.models.fields.CharField')(max_length=40)),
+ ('comment', self.gf('django.db.models.fields.TextField')()),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['Container'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'WarehouseType'
+ db.delete_table('archaeological_warehouse_warehousetype')
+
+ # Deleting model 'Warehouse'
+ db.delete_table('archaeological_warehouse_warehouse')
+
+ # Deleting model 'ContainerType'
+ db.delete_table('archaeological_warehouse_containertype')
+
+ # Deleting model 'Container'
+ db.delete_table('archaeological_warehouse_container')
+
+
+ models = {
+ 'archaeological_warehouse.container': {
+ 'Meta': {'object_name': 'Container'},
+ 'comment': ('django.db.models.fields.TextField', [], {}),
+ 'container_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.ContainerType']"}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']"}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '40'})
+ },
+ 'archaeological_warehouse.containertype': {
+ 'Meta': {'object_name': 'ContainerType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+ 'volume': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_warehouse.warehouse': {
+ 'Meta': {'object_name': 'Warehouse'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'person_in_charge': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'warehouse_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.WarehouseType']"})
+ },
+ 'archaeological_warehouse.warehousetype': {
+ 'Meta': {'object_name': 'WarehouseType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'ishtar_common.organization': {
+ 'Meta': {'object_name': 'Organization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.organizationtype': {
+ 'Meta': {'object_name': 'OrganizationType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.person': {
+ 'Meta': {'object_name': 'Person'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'person_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.PersonType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.persontype': {
+ 'Meta': {'object_name': 'PersonType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'rights': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.WizardStep']", 'symmetrical': 'False'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.wizard': {
+ 'Meta': {'ordering': "['url_name']", 'object_name': 'Wizard'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
+ },
+ 'ishtar_common.wizardstep': {
+ 'Meta': {'ordering': "['wizard', 'order']", 'object_name': 'WizardStep'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'wizard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Wizard']"})
+ }
+ }
+
+ complete_apps = ['archaeological_warehouse'] \ No newline at end of file
diff --git a/archaeological_warehouse/migrations/__init__.py b/archaeological_warehouse/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_warehouse/migrations/__init__.py
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
new file mode 100644
index 000000000..fe381e521
--- /dev/null
+++ b/archaeological_warehouse/models.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# See the file COPYING for details.
+
+from django.conf import settings
+from django.contrib.gis.db import models
+from django.utils.translation import ugettext_lazy as _, ugettext
+
+from ishtar_common.models import GeneralType, BaseHistorizedItem, \
+ LightHistorizedItem, OwnPerms, Address, Person
+
+
+class WarehouseType(GeneralType):
+ class Meta:
+ verbose_name = _(u"Warehouse type")
+ verbose_name_plural = _(u"Warehouse types")
+
+class Warehouse(Address, OwnPerms):
+ name = models.CharField(_(u"Name"), max_length=40)
+ warehouse_type = models.ForeignKey(WarehouseType,
+ verbose_name=_(u"Warehouse type"))
+ person_in_charge = models.ForeignKey(Person,
+ verbose_name=_(u"Person in charge"), null=True, blank=True)
+ comment = models.TextField(_(u"Comment"), null=True, blank=True)
+
+ class Meta:
+ verbose_name = _(u"Warehouse")
+ verbose_name_plural = _(u"Warehouses")
+ permissions = (
+ ("view_own_warehouse", ugettext(u"Can view own Warehouse")),
+ ("add_own_warehouse", ugettext(u"Can add own Warehouse")),
+ ("change_own_warehouse", ugettext(u"Can change own Warehouse")),
+ ("delete_own_warehouse", ugettext(u"Can delete own Warehouse")),
+ )
+
+ def __unicode__(self):
+ return u"%s (%s)" % (self.name, unicode(self.warehouse_type))
+
+
+class ContainerType(GeneralType):
+ length = models.IntegerField(_(u"Length (mm)"), blank=True, null=True)
+ width = models.IntegerField(_(u"Width (mm)"), blank=True, null=True)
+ height = models.IntegerField(_(u"Height (mm)"), blank=True, null=True)
+ volume = models.IntegerField(_(u"Volume (l)"), blank=True, null=True)
+ reference = models.CharField(_(u"Reference"), max_length=30)
+
+ class Meta:
+ verbose_name = _(u"Container type")
+ verbose_name_plural = _(u"Container types")
+
+class Container(LightHistorizedItem):
+ TABLE_COLS = ['reference', 'container_type', 'location',]
+ location = models.ForeignKey(Warehouse, verbose_name=_(u"Warehouse"))
+ container_type = models.ForeignKey(ContainerType,
+ verbose_name=_("Container type"))
+ reference = models.CharField(_(u"Reference"), max_length=40)
+ comment = models.TextField(_(u"Comment"))
+
+ class Meta:
+ verbose_name = _(u"Container")
+ verbose_name_plural = _(u"Containers")
+
+ def __unicode__(self):
+ lbl = u" - ".join((self.reference, unicode(self.container_type),
+ unicode(self.location)))
+ return lbl
+