Skip to content

Commit

Permalink
Show Drive start/end location, driver and passenger as columns (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturtamborski authored Jul 29, 2020
1 parent 599dff7 commit 1f04d55
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions backend/fleet_management/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ class Meta:
)
export_order = fields

def dehydrate_driver(self, drive):
return str(drive.driver)

def dehydrate_country(self, drive):
return str(drive.country.name)

def dehydrate_driver(self, drive):
return str(drive.driver)

def dehydrate_passenger(self, drive):
return str(drive.passenger)

Expand All @@ -71,19 +71,27 @@ def dehydrate_passenger(self, drive):
class DriveAdmin(ImportExportModelAdmin):
resource_class = DriveResource
list_filter = (CountryFilter,)
list_display = ("__str__", "country", "is_verified")
list_display = (
"date",
"start_location",
"end_location",
"driver",
"passenger",
"country",
"is_verified",
)


@admin.register(Car)
class CarAdmin(admin.ModelAdmin):
list_filter = (CountryFilter,)
list_display = ("__str__", "country")
list_display = ("plates", "description", "fuel_consumption", "country")


@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
list_filter = (CountryFilter,)
list_display = ("__str__", "country")
list_display = ("title", "country")


@admin.register(User)
Expand Down

0 comments on commit 1f04d55

Please sign in to comment.