Skip to content

Commit

Permalink
Rename user to author, add comment to lendinginstance
Browse files Browse the repository at this point in the history
  • Loading branch information
Bestem0r committed Mar 5, 2024
1 parent dcf7b07 commit e549314
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lego/apps/lending/fixtures/development_lending_requests.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
- fields:
lendable_object: 1
user: 3
created_by: 3
start_date: '2024-02-02T23:16:00+00:00'
end_date: '2024-02-02T23:18:00+00:00'
# message: "Jeg vil låne grill :)"
comment: "Jeg vil låne grill :)"
pending: True # Should be a status field with multiple options
model: lending.LendingInstance
pk: 1
- fields:
lendable_object: 2
user: 3
created_by: 3
start_date: '2024-02-02T23:16:00+00:00'
end_date: '2024-02-02T23:18:00+00:00'
pending: True
Expand Down
18 changes: 18 additions & 0 deletions lego/apps/lending/migrations/0006_lendinginstance_comment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.10 on 2024-03-05 20:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('lending', '0005_remove_lendinginstance_user'),
]

operations = [
migrations.AddField(
model_name='lendinginstance',
name='comment',
field=models.TextField(blank=True),
),
]
1 change: 1 addition & 0 deletions lego/apps/lending/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class LendingInstance(BasisModel):
start_date = models.DateTimeField(null=True)
end_date = models.DateTimeField(null=True)
pending = models.BooleanField(default=True)
comment = models.TextField(null=False, blank=True)

objects = LendingInstanceManager() # type: ignore

Expand Down
5 changes: 3 additions & 2 deletions lego/apps/lending/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Meta:


class LendingInstanceSerializer(BasisModelSerializer):
user = PublicUserSerializer(read_only=True, source="created_by")
author = PublicUserSerializer(read_only=True, source="created_by")

class Meta:
model = LendingInstance
Expand All @@ -24,8 +24,9 @@ class Meta:
"lendable_object",
"start_date",
"end_date",
"user",
"author",
"pending",
"comment",
"created_at",
)

Expand Down

0 comments on commit e549314

Please sign in to comment.