I’m trying to create simple Event app, so I’ve decided to create event and some inline event occurances:
class EventOccurenceInline(admin.TabularInline):
model = models.EventOccurance
form = forms.EventOccuranceForm
pass
class EventAdmin(TranslatableAdmin):
list_display = [ "internal_name"]
inlines = [
EventOccurenceInline,
]
pass
and here is forms.py:
class EventOccurenceForm(TranslatableModelForm):
start_date = forms.DateTimeField()
end_date = forms.DateTimeField()
class Meta:
model = models.EventOccurence
But, when I open my backend I see only simple inputs instead of DateTime pickers, and even labels for those fields say nothing:

Does anyone know how to use those widgets inside inlines? What am I doing wrong?
thanks in advance,
Michael
It looks like the problem is that you’re declaring the
start_dateandend_datefields in theEventOccurenceFormclass without any arguments.Here is a quote from Django’s “Creating forms from models” documentation in the Overriding the default field types or widgets section:
Why are you declaring the
start_dateandend_datefields in theEventOccurenceFormclass, anyway? Is it because you’re trying to only have those two fields in the form? If that’s the case, you should use thefieldsattribute of the innerMetaclass instead.I’m assuming the
EventOccurencemodel’sstart_dateandend_datefields areDateFields and, thus, within Django admin, they will have theAdminDateWidgetwidget by default. If, for some reason, that isn’t the case and you can’t change the model, you could always use thewidgetsattribute of theEventOccurenceFormclass’s innerMetaclass, like this: