Skip to content

Commit

Permalink
Use a proper date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepman4267 committed Sep 26, 2024
1 parent 844486e commit d3be12b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 15 additions & 3 deletions hat/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.forms import ModelForm
from .models import Item
from django.forms import ModelForm, widgets
from .models import Item, Meeting


class ItemForm(ModelForm):
Expand All @@ -9,4 +9,16 @@ class ItemForm(ModelForm):
'meeting',
'major',
'finished',
]
]


class MeetingCreateForm(ModelForm):
class Meta:
widgets = {
'date': widgets.DateInput(attrs={'type': 'date'}),
}
model = Meeting
fields = [
'title',
'date',
]
8 changes: 3 additions & 5 deletions hat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

from .models import Item, Meeting

from .forms import ItemForm
from .forms import ItemForm, MeetingCreateForm


# def index(request):
# return render(request, 'hat/hat.html', {
Expand Down Expand Up @@ -98,10 +99,7 @@ def get_context_data(self, **kwargs):
class MeetingCreateView(CreateView):
model = Meeting
template_name = "hat/meeting_create.html"
fields = [
'title',
'date',
]
form_class = MeetingCreateForm


class ItemUpdateView(UpdateView):
Expand Down

0 comments on commit d3be12b

Please sign in to comment.