On May 3, 2015, at 7:17 PM, Mike Dewhirst <miked@dewhirst.com.au> wrote:
> On 4/05/2015 11:41 AM, Tom Lockhart wrote:
>> On May 3, 2015, at 2:35 PM, Matthys <matthysk@gmail.com> wrote:
>>
>>> I posted the question also on stackoverflow:
>>>
>>> http://stackoverflow.com/questions/30017229/how-to-represent-month-as-field-on-django-model
>>>
>>> The question is for situations where a model instance relates to a specific month, but not to a specific day.
>>
>> I would use a date field and, perhaps, clean the data to force the day to be the first day of the month. Then you can do date/time arithmetic using standard features.
>
> Surely that would destroy data which wouldn't be desirable.
I'm not sure how that follows. Although the question does not state it explicitly, I believe that the OP is interested in dates for which only the year and month are significant. Saving the month as a separate field seems to overly complicate the problem if any date/time arithmetic is required.
Perhaps I'm not understanding the downsides here (data destruction did not seem to be a side effect of my suggestion, beyond rounding the date to the application's precision of interest): under what circumstances would it be desirable to store dates but not use date field functionality?
Regards,
- Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/A8784BEE-7AFD-4472-8217-7F81979C56E3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment