Skip to content

Commit

Permalink
Use DecimalFields for admin inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jkrzy committed Apr 24, 2020
1 parent 5dbccc0 commit 31273a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tock/employees/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@


class UserDataForm(forms.ModelForm):
billable_expectation = forms.DecimalField(initial=0.80)

class Meta:
model = UserData
exclude = []
Expand Down
10 changes: 10 additions & 0 deletions tock/hours/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.contrib import admin
from django.core.exceptions import ValidationError
from django.forms.models import BaseInlineFormSet
from django.forms import DecimalField, ModelForm

from .models import (
HolidayPrefills,
Expand Down Expand Up @@ -77,11 +78,20 @@ class TimecardObjectInline(admin.TabularInline):
]


class TimecardAdminForm(ModelForm):
billable_expectation = DecimalField(initial=0.80)

class Meta:
model = Timecard
fields = '__all__'


class TimecardAdmin(admin.ModelAdmin):
inlines = (TimecardObjectInline,)
list_display = ('user', 'reporting_period', 'submitted')
list_filter = (ReportingPeriodListFilter, 'reporting_period',)
search_fields = ['user__username', 'reporting_period__start_date', 'reporting_period__end_date',]
form = TimecardAdminForm


class TimecardNoteAdmin(admin.ModelAdmin):
Expand Down

0 comments on commit 31273a0

Please sign in to comment.