mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-05-28 02:19:31 +02:00
refactor: move some fields and widgets around
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from datetime import datetime, date
|
||||
|
||||
from django import forms
|
||||
|
||||
|
||||
class MonthYearWidget(forms.DateInput):
|
||||
"""
|
||||
Custom widget to display a month-year picker.
|
||||
"""
|
||||
|
||||
input_type = "month" # Set the input type to 'month'
|
||||
|
||||
def format_value(self, value):
|
||||
if isinstance(value, (datetime, date)):
|
||||
return value.strftime("%Y-%m")
|
||||
return value
|
||||
Reference in New Issue
Block a user