Fixed asset permissions

This commit is contained in:
Matthew Smith
2019-10-17 20:54:39 +01:00
parent 9f9ccd3b0c
commit b39f835a38
4 changed files with 33 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
# Generated by Django 2.0.13 on 2019-10-17 19:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('assets', '0013_auto_20191016_1446'),
]
operations = [
migrations.AlterModelOptions(
name='asset',
options={'ordering': ['asset_id'], 'permissions': (('asset_finance', 'Can see financial data for assets'), ('view_asset', 'Can view an asset'))},
),
migrations.AlterModelOptions(
name='supplier',
options={'permissions': (('view_supplier', 'Can view a supplier'),)},
),
]

View File

@@ -33,6 +33,12 @@ class AssetStatus(models.Model):
class Supplier(models.Model):
name = models.CharField(max_length=80)
class Meta:
permissions = (
('view_supplier', 'Can view a supplier'),
)
def get_absolute_url(self):
return reverse('supplier_list')
@@ -55,6 +61,7 @@ class Asset(models.Model):
ordering = ['asset_id']
permissions = (
('asset_finance', 'Can see financial data for assets'),
('view_asset', 'Can view an asset')
)
parent = models.ForeignKey(to='self', related_name='asset_parent', blank=True, null=True, on_delete=models.SET_NULL)