There should be a published_date field in CompendiumEntry that indicates when an entry was published. This will be useful for searching based on publication date.
Implementing this might be more complicated than it would initially appear. There might be cases in which we don't know when something was published. More problematic, though, are cases in which we may know say, the year in which something was published, but not the specific month or day. From my point of view, there are three solutions to this:
Ignore the problem: just add published_date as a DateField to CompendiumEntry. When users need to add a new CompendiumEntry, they should just pick some date, even if it's not exactly correct. For instance, they could choose January 1 1980 for an article they know was published in 1980, but where they don't know the month/day it was published.
HaveCompendiumEntryFormchoose a default month/day: still add published_date as a DateField to CompendiumEntry. However, we modify CompendiumEntryForm so that it has separate entries for day, month, and year, and allow these entries to be blank. Make CompendiumEntryForm combine the fields in some sensible way -- e.g., if the user specifies the month as March and the year as 1995, then have CompendiumEntryForm return the date as March 1 1985.
If you go down this route, you'll probably want to perform validation to ensure that the year isn't blank if the month is specified, and that both the month and year aren't blank if the day is specified.
Represent month, day, and year as separate fields: in the CompendiumEntry model, specify day, month, and year as three PositiveSmallInteger fields. Otherwise, modify CompendiumEntryForm as we did in the second approach. Not recommended since this will likely cause other problems down the road.
My personal recommendation is that we go with the second approach long-term, but at least for the immediate future the first approach should be sufficient. Whichever option we choose, we should make sure to add some help_text to CompendiumEntryForm that explains how the date should be entered.
Added date as three different fields. Checks to verify controls like if month is entered, year has to be entered can be taken care in future as an enhancement.
There should be a
published_date
field inCompendiumEntry
that indicates when an entry was published. This will be useful for searching based on publication date.Implementing this might be more complicated than it would initially appear. There might be cases in which we don't know when something was published. More problematic, though, are cases in which we may know say, the year in which something was published, but not the specific month or day. From my point of view, there are three solutions to this:
published_date
as aDateField
toCompendiumEntry
. When users need to add a newCompendiumEntry
, they should just pick some date, even if it's not exactly correct. For instance, they could chooseJanuary 1 1980
for an article they know was published in 1980, but where they don't know the month/day it was published.CompendiumEntryForm
choose a default month/day: still addpublished_date
as aDateField
toCompendiumEntry
. However, we modifyCompendiumEntryForm
so that it has separate entries for day, month, and year, and allow these entries to be blank. MakeCompendiumEntryForm
combine the fields in some sensible way -- e.g., if the user specifies the month asMarch
and the year as1995
, then haveCompendiumEntryForm
return the date asMarch 1 1985
.CompendiumEntry
model, specifyday
,month
, andyear
as threePositiveSmallInteger
fields. Otherwise, modifyCompendiumEntryForm
as we did in the second approach. Not recommended since this will likely cause other problems down the road.My personal recommendation is that we go with the second approach long-term, but at least for the immediate future the first approach should be sufficient. Whichever option we choose, we should make sure to add some
help_text
toCompendiumEntryForm
that explains how the date should be entered.