Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added slots in asset model, yield with assets for api #5

Merged
merged 7 commits into from
This page is out of date. Refresh to see the latest.
View
20 src/ralph_assets/api_pricing.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from ralph_assets.models_assets import Asset
+
+def get_assets():
+ """Yields dicts describing all assets"""
+ for asset in Asset.objects.all():
+ yield {
+ 'name': asset.sn,
+ 'asset_id': asset.id,
+ 'ralph_id': device_info.ralph_device.id,
+ 'slots': asset.slots,
+ 'price': asset.price,
+ 'is_deprecated': asset.is_deprecated()
+ }
View
2  src/ralph_assets/forms.py
@@ -287,6 +287,7 @@ class Meta:
'delivery_date',
'invoice_date',
'production_use_date',
+ 'slots',
)
widgets = {
'request_date': DateWidget(),
@@ -372,6 +373,7 @@ class Meta:
'invoice_date',
'production_use_date',
'deleted',
+ 'slots',
)
widgets = {
'request_date': DateWidget(),
View
505 src/ralph_assets/migrations/0002_auto__add_field_asset_slots__chg_field_asset_sn__add_unique_assetmodel.py
@@ -0,0 +1,505 @@
+# -*- 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 field 'Asset.slots'
+ db.add_column('ralph_assets_asset', 'slots',
+ self.gf('django.db.models.fields.FloatField')(default=0, max_length=64),
+ keep_default=False)
+
+
+ # Changing field 'Asset.sn'
+ db.alter_column('ralph_assets_asset', 'sn', self.gf('django.db.models.fields.CharField')(max_length=200, unique=True, null=True))
+ # Adding index on 'AssetModel', fields ['name']
+ db.create_index('ralph_assets_assetmodel', ['name'])
+
+ # Adding unique constraint on 'AssetModel', fields ['name']
+ db.create_unique('ralph_assets_assetmodel', ['name'])
+
+
+ # Changing field 'AssetModel.manufacturer'
+ db.alter_column('ralph_assets_assetmodel', 'manufacturer_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ralph_assets.AssetManufacturer'], null=True, on_delete=models.PROTECT))
+ # Adding index on 'Warehouse', fields ['name']
+ db.create_index('ralph_assets_warehouse', ['name'])
+
+ # Adding unique constraint on 'Warehouse', fields ['name']
+ db.create_unique('ralph_assets_warehouse', ['name'])
+
+ # Adding index on 'AssetManufacturer', fields ['name']
+ db.create_index('ralph_assets_assetmanufacturer', ['name'])
+
+ # Adding unique constraint on 'AssetManufacturer', fields ['name']
+ db.create_unique('ralph_assets_assetmanufacturer', ['name'])
+
+ # Adding field 'OfficeInfo.deleted'
+ db.add_column('ralph_assets_officeinfo', 'deleted',
+ self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True),
+ keep_default=False)
+
+ # Adding field 'PartInfo.deleted'
+ db.add_column('ralph_assets_partinfo', 'deleted',
+ self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True),
+ keep_default=False)
+
+ # Adding field 'DeviceInfo.deleted'
+ db.add_column('ralph_assets_deviceinfo', 'deleted',
+ self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Removing unique constraint on 'AssetManufacturer', fields ['name']
+ db.delete_unique('ralph_assets_assetmanufacturer', ['name'])
+
+ # Removing index on 'AssetManufacturer', fields ['name']
+ db.delete_index('ralph_assets_assetmanufacturer', ['name'])
+
+ # Removing unique constraint on 'Warehouse', fields ['name']
+ db.delete_unique('ralph_assets_warehouse', ['name'])
+
+ # Removing index on 'Warehouse', fields ['name']
+ db.delete_index('ralph_assets_warehouse', ['name'])
+
+ # Removing unique constraint on 'AssetModel', fields ['name']
+ db.delete_unique('ralph_assets_assetmodel', ['name'])
+
+ # Removing index on 'AssetModel', fields ['name']
+ db.delete_index('ralph_assets_assetmodel', ['name'])
+
+ # Deleting field 'Asset.slots'
+ db.delete_column('ralph_assets_asset', 'slots')
+
+
+ # User chose to not deal with backwards NULL issues for 'Asset.sn'
+ raise RuntimeError("Cannot reverse this migration. 'Asset.sn' and its values cannot be restored.")
+
+ # User chose to not deal with backwards NULL issues for 'AssetModel.manufacturer'
+ raise RuntimeError("Cannot reverse this migration. 'AssetModel.manufacturer' and its values cannot be restored.")
+ # Deleting field 'OfficeInfo.deleted'
+ db.delete_column('ralph_assets_officeinfo', 'deleted')
+
+ # Deleting field 'PartInfo.deleted'
+ db.delete_column('ralph_assets_partinfo', 'deleted')
+
+ # Deleting field 'DeviceInfo.deleted'
+ db.delete_column('ralph_assets_deviceinfo', 'deleted')
+
+
+ models = {
+ 'account.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'activation_token': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '40', 'blank': 'True'}),
+ 'birth_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'city': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.PositiveIntegerField', [], {'default': '153'}),
+ 'gender': ('django.db.models.fields.PositiveIntegerField', [], {'default': '2'}),
+ 'home_page': (u'dj.choices.fields.ChoiceField', [], {'unique': 'False', 'primary_key': 'False', 'db_column': 'None', 'blank': 'False', u'default': '1', 'null': 'False', '_in_south': 'True', 'db_index': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_active': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'nick': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '30', 'blank': 'True'}),
+ 'time_zone': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
+ },
+ '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'})
+ },
+ 'business.department': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'Department'},
+ 'icon': (u'dj.choices.fields.ChoiceField', [], {'unique': 'False', 'primary_key': 'False', 'db_column': 'None', 'blank': 'True', u'default': 'None', 'null': 'True', '_in_south': 'True', 'db_index': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'business.venture': {
+ 'Meta': {'ordering': "(u'parent__symbol', u'symbol')", 'unique_together': "((u'parent', u'symbol'),)", 'object_name': 'Venture'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'data_center': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['discovery.DataCenter']", 'null': 'True', 'blank': 'True'}),
+ 'department': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['business.Department']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_infrastructure': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'margin_kind': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.MarginKind']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "u'child_set'", 'null': 'True', 'blank': 'True', 'to': "orm['business.Venture']"}),
+ 'path': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'preboot': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['deployment.Preboot']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'show_in_ralph': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'symbol': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '32', 'blank': 'True'})
+ },
+ 'business.venturerole': {
+ 'Meta': {'ordering': "(u'parent__name', u'name')", 'unique_together': "((u'name', u'venture'),)", 'object_name': 'VentureRole'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '75'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "u'child_set'", 'null': 'True', 'blank': 'True', 'to': "orm['business.VentureRole']"}),
+ 'path': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'preboot': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['deployment.Preboot']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'venture': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['business.Venture']"})
+ },
+ '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'})
+ },
+ 'deployment.preboot': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'Preboot'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'description': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'files': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['deployment.PrebootFile']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'deployment.prebootfile': {
+ 'Meta': {'object_name': 'PrebootFile'},
+ 'description': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'file': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'ftype': (u'dj.choices.fields.ChoiceField', [], {'unique': 'False', 'primary_key': 'False', 'db_column': 'None', 'blank': 'False', u'default': '101', 'null': 'False', '_in_south': 'True', 'db_index': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'raw_config': ('django.db.models.fields.TextField', [], {'blank': 'True'})
+ },
+ 'discovery.datacenter': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'DataCenter'},
+ 'hosts_naming_template': ('django.db.models.fields.CharField', [], {'default': "u'h<10000,19999>.dc'", 'max_length': '30'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'next_server': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '32', 'blank': 'True'})
+ },
+ 'discovery.deprecationkind': {
+ 'Meta': {'object_name': 'DeprecationKind'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'months': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'remarks': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'})
+ },
+ 'discovery.device': {
+ 'Meta': {'object_name': 'Device'},
+ 'barcode': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'boot_firmware': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'cached_cost': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'cached_price': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'chassis_position': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'dc': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'deprecation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'deprecation_kind': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.DeprecationKind']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'diag_firmware': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'hard_firmware': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'management': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'managed_set'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['discovery.IPAddress']", 'blank': 'True', 'null': 'True'}),
+ 'margin_kind': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.MarginKind']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'max_save_priority': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'mgmt_firmware': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'model': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'device_set'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['discovery.DeviceModel']", 'blank': 'True', 'null': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'name2': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'child_set'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['discovery.Device']", 'blank': 'True', 'null': 'True'}),
+ 'position': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
+ 'price': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'purchase_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'rack': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'remarks': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'role': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'save_priorities': ('django.db.models.fields.TextField', [], {'default': "u''"}),
+ 'sn': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'support_expiration_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'support_kind': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'uptime_seconds': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'uptime_timestamp': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'venture': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['business.Venture']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'venture_role': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['business.VentureRole']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'warranty_expiration_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'discovery.devicemodel': {
+ 'Meta': {'object_name': 'DeviceModel'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'chassis_size': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.DeviceModelGroup']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'max_save_priority': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'save_priorities': ('django.db.models.fields.TextField', [], {'default': "u''"}),
+ 'type': ('django.db.models.fields.PositiveIntegerField', [], {'default': '401'})
+ },
+ 'discovery.devicemodelgroup': {
+ 'Meta': {'object_name': 'DeviceModelGroup'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'price': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'slots': ('django.db.models.fields.FloatField', [], {'default': '0'}),
+ 'type': ('django.db.models.fields.PositiveIntegerField', [], {'default': '401'})
+ },
+ 'discovery.discoveryqueue': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'DiscoveryQueue'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'discovery.ipaddress': {
+ 'Meta': {'object_name': 'IPAddress'},
+ 'address': ('django.db.models.fields.IPAddressField', [], {'default': 'None', 'max_length': '15', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'device': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.Device']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'dns_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'hostname': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'http_family': ('django.db.models.fields.TextField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_management': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_plugins': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'last_puppet': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'network': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.Network']", 'null': 'True', 'blank': 'True'}),
+ 'number': ('django.db.models.fields.BigIntegerField', [], {'unique': 'True'}),
+ 'snmp_community': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'blank': 'True'}),
+ 'snmp_name': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ },
+ 'discovery.marginkind': {
+ 'Meta': {'object_name': 'MarginKind'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'margin': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'remarks': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'})
+ },
+ 'discovery.network': {
+ 'Meta': {'ordering': "(u'vlan',)", 'object_name': 'Network'},
+ 'address': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '18'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'data_center': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['discovery.DataCenter']"}),
+ 'dhcp_config': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'gateway': ('django.db.models.fields.IPAddressField', [], {'default': 'None', 'max_length': '15', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ignore_addresses': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'kind': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.NetworkKind']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'max_ip': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'min_ip': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
+ 'queue': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['discovery.DiscoveryQueue']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'racks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['discovery.Device']", 'symmetrical': 'False'}),
+ 'remarks': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}),
+ 'reserved': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10'}),
+ 'reserved_top_margin': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'terminators': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['discovery.NetworkTerminator']", 'symmetrical': 'False'}),
+ 'vlan': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ },
+ 'discovery.networkkind': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'NetworkKind'},
+ 'icon': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'discovery.networkterminator': {
+ 'Meta': {'ordering': "(u'name',)", 'object_name': 'NetworkTerminator'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'ralph_assets.asset': {
+ 'Meta': {'object_name': 'Asset'},
+ 'barcode': ('django.db.models.fields.CharField', [], {'max_length': '200', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ralph_assets.AssetCategory']", 'null': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'device_info': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ralph_assets.DeviceInfo']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'invoice_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'invoice_no': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'model': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ralph_assets.AssetModel']", 'on_delete': 'models.PROTECT'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'office_info': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ralph_assets.OfficeInfo']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'order_no': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
+ 'part_info': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ralph_assets.PartInfo']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'price': ('django.db.models.fields.DecimalField', [], {'default': '0', 'max_digits': '10', 'decimal_places': '2'}),
+ 'production_use_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'provider': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'provider_order_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'remarks': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
+ 'request_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'slots': ('django.db.models.fields.FloatField', [], {'default': '0', 'max_length': '64'}),
+ 'sn': ('django.db.models.fields.CharField', [], {'max_length': '200', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'source': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
+ 'support_period': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'support_price': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+ 'support_type': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
+ 'support_void_reporting': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
+ 'type': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+ 'warehouse': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ralph_assets.Warehouse']", 'on_delete': 'models.PROTECT'})
+ },
+ 'ralph_assets.assetcategory': {
+ 'Meta': {'object_name': 'AssetCategory'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
+ 'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "u'children'", 'null': 'True', 'to': "orm['ralph_assets.AssetCategory']"}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'type': ('django.db.models.fields.PositiveIntegerField', [], {})
+ },
+ 'ralph_assets.assethistorychange': {
+ 'Meta': {'object_name': 'AssetHistoryChange'},
+ 'asset': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['ralph_assets.Asset']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'device_info': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['ralph_assets.DeviceInfo']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'field_name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '64'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'new_value': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255'}),
+ 'office_info': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['ralph_assets.OfficeInfo']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'old_value': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255'}),
+ 'part_info': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['ralph_assets.PartInfo']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['auth.User']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'})
+ },
+ 'ralph_assets.assetmanufacturer': {
+ 'Meta': {'object_name': 'AssetManufacturer'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'ralph_assets.assetmodel': {
+ 'Meta': {'object_name': 'AssetModel'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'manufacturer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ralph_assets.AssetManufacturer']", 'null': 'True', 'on_delete': 'models.PROTECT', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'ralph_assets.deviceinfo': {
+ 'Meta': {'object_name': 'DeviceInfo'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'ralph_device': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['discovery.Device']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'size': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'})
+ },
+ 'ralph_assets.officeinfo': {
+ 'Meta': {'object_name': 'OfficeInfo'},
+ 'attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_of_last_inventory': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_logged_user': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'license_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'license_type': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'version': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'})
+ },
+ 'ralph_assets.partinfo': {
+ 'Meta': {'object_name': 'PartInfo'},
+ 'barcode_salvaged': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'device': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'device'", 'null': 'True', 'to': "orm['ralph_assets.Asset']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'source_device': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'source_device'", 'null': 'True', 'to': "orm['ralph_assets.Asset']"})
+ },
+ 'ralph_assets.warehouse': {
+ 'Meta': {'object_name': 'Warehouse'},
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'+'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['account.Profile']", 'blank': 'True', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'})
+ },
+ 'tags.tag': {
+ 'Meta': {'object_name': 'Tag'},
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['account.Profile']"}),
+ 'cache_version': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'tags_tag_tags'", 'to': "orm['contenttypes.ContentType']"}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.PositiveIntegerField', [], {'default': '39'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '75'}),
+ 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
+ 'official': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'stem': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'related_tags'", 'null': 'True', 'to': "orm['tags.TagStem']"})
+ },
+ 'tags.tagstem': {
+ 'Meta': {'object_name': 'TagStem'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.PositiveIntegerField', [], {'default': '39'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '75'}),
+ 'tag_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
+ }
+ }
+
+ complete_apps = ['ralph_assets']
View
18 src/ralph_assets/models_assets.py
@@ -10,6 +10,8 @@
import os
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
from django.db import models
from django.utils.translation import ugettext_lazy as _
from lck.django.common.models import (
@@ -205,7 +207,11 @@ class Asset(TimeTrackable, EditorTrackable, SavingUser, SoftDeletable):
production_use_date = models.DateField(null=True, blank=True)
provider_order_date = models.DateField(null=True, blank=True)
category = models.ForeignKey('AssetCategory', null=True, blank=True)
-
+ slots = models.FloatField(
+ verbose_name='Slots (for blade centers)',
+ max_length=64,
+ default=0,
+ )
admin_objects = AssetAdminManager()
admin_objects_dc = DCAdminManager()
admin_objects_bo = BOAdminManager()
@@ -266,6 +272,16 @@ def __init__(self, *args, **kwargs):
self.saving_user = None
super(Asset, self).__init__(*args, **kwargs)
+ def is_deprecated(self):
+ if not self.support_period or not self.invoice_date:
+ return False
+ if isinstance(self.invoice_date, basestring):
+ self.invoice_date = datetime.strptime(self.invoice_date,'%Y-%m-%d')
+ deprecation_date = self.invoice_date + relativedelta(
+ months=self.support_period
+ )
+ return deprecation_date < datetime.today()
+
class DeviceInfo(TimeTrackable, SavingUser, SoftDeletable):
ralph_device = models.ForeignKey(
View
0  src/ralph_assets/tests/unit/__init__.py
No changes.
View
38 src/ralph_assets/tests/unit/tests_models.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from django.test import TestCase
+
+from ralph_assets.models_assets import Asset
+from ralph_assets.tests.util import (
+ create_asset,
+ create_category,
+ create_model,
+ create_warehouse,
+ create_manufacturer,
+)
+
+
+class TestModelAsset(TestCase):
+ def setUp(self):
+ self.asset = create_asset(
+ sn='1111-1111-1111-1111',
+ invoice_date='2012-11-28',
+ support_period=1,
+ )
+ self.asset2 = create_asset(
+ sn='1111-1111-1111-1112',
+ invoice_date='2012-11-28',
+ support_period=120,
+ )
+
+
+ def test_is_deperecation(self):
+ self.assertEqual(self.asset.is_deprecated(), True)
+ self.assertEqual(self.asset2.is_deprecated(), False)
+
+
View
17 src/ralph_assets/tests/util.py
@@ -40,14 +40,12 @@
def create_manufacturer(name=DEFAULT_ASSET_DATA['manufacturer']):
- manufacturer = AssetManufacturer(name=name)
- manufacturer.save()
+ manufacturer, created = AssetManufacturer.objects.get_or_create(name=name)
return manufacturer
def create_warehouse(name=DEFAULT_ASSET_DATA['warehouse']):
- warehouse = Warehouse(name=name)
- warehouse.save()
+ warehouse, created = Warehouse.objects.get_or_create(name=name)
return warehouse
@@ -55,11 +53,12 @@ def create_model(name=DEFAULT_ASSET_DATA['model'], manufacturer=None):
"""name = string, manufacturer = string"""
if not manufacturer:
manufacturer = create_manufacturer()
- model = AssetModel(
- manufacturer=create_manufacturer(manufacturer),
- name=name,
- )
- model.save()
+ else:
+ manufacturer = create_manufacturer(manufacturer)
+ model, created = AssetModel.objects.get_or_create(name=name)
+ if created:
+ model.manufacturer = manufacturer
+ model.save()
return model
Something went wrong with that request. Please try again.