diff --git a/models.py b/models.py index 8a341f54..b95f45de 100644 --- a/models.py +++ b/models.py @@ -44,10 +44,10 @@ class BaseAsset(models.Model): asset_id = models.CharField(max_length=10) description = models.CharField(max_length=120) category = models.ForeignKey(to=AssetCategory, on_delete=models.CASCADE) - status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE, default='Active') + status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE) serial_number = models.CharField(max_length=150, blank=True) purchased_from = models.ForeignKey(to=Supplier, on_delete=models.CASCADE, blank=True, null=True) - date_acquired = models.DateField(default=datetime.date.today().strftime('%d %b %Y')) + date_acquired = models.DateField() date_sold = models.DateField(blank=True, null=True) purchase_price = models.DecimalField(blank=True, null=True, decimal_places=2, max_digits=10) salvage_value = models.DecimalField(blank=True, null=True, decimal_places=2, max_digits=10) diff --git a/templates/asset_update.html b/templates/asset_update.html index b10bc7fb..fd6333e8 100644 --- a/templates/asset_update.html +++ b/templates/asset_update.html @@ -30,8 +30,10 @@ {% if edit %} {# #} - Duplicate + {% if object.pk %} + Duplicate + {% endif %} {% elif duplicate %} Cancel @@ -56,55 +58,54 @@