Skip to content

Commit

Permalink
fixed view and model
Browse files Browse the repository at this point in the history
  • Loading branch information
erlendska committed Feb 21, 2024
1 parent 57979c8 commit c61416f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inventory/models/item_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ItemLoan(models.Model):
amount = models.IntegerField("Antall", validators=[MinValueValidator(1)])

# Automatically set once the application is accepted
loan_from = models.DateField("Lån fra", default=timezone.now)
loan_from = models.DateField("Lån fra", default=timezone.now().strftime("%d.%m.%Y"))
loan_to = models.DateField("Lån til")
purpose = models.CharField("Formål", max_length=50)

Expand Down
1 change: 1 addition & 0 deletions inventory/views/item_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def get_form(self, *args, **kwargs):
max_date = datetime.now() + timedelta(days=max_duration)
form.fields["loan_to"].widget.attrs["data-max-date"] = max_date
form.fields["loan_to"].widget.attrs["class"] = "datepicker"
form.fields["loan_from"].widget.attrs["class"] = "datepicker"
return form

def get_context_data(self, **kwargs):
Expand Down

0 comments on commit c61416f

Please sign in to comment.