Skip to content

Changing the defaults

David Moore edited this page Jul 17, 2020 · 1 revision

To change the default values (or other) properties of fields I suggest using _meta.get_field Unfortunately you will have to do this on each of SimpleEventPage, MultidayEventPage and RecurringEventPage (using EventBase does not work). e.g.

from ls.joyous.models import (SimpleEventPage, MultidayEventPage, RecurringEventPage)
for EventPage in (SimpleEventPage, MultidayEventPage, RecurringEventPage):
    EventPage._meta.get_field('location').default = "New York"
    EventPage._meta.get_field('website').default  = "example.org"

There will be other ways to do this (signals, inheritence, Javascript), but this is probably the easiest.

Clone this wiki locally