Hi,
I ended up creating a custom field (
https://github.com/clearspark/django-monthfield).
I used a lot of your input, thank you all.
Cheers,
Matthys
On Mon, May 4, 2015 at 7:09 PM, Tim Chase
wrote:
> On 2015-05-03 14:35, Matthys wrote:
> > I posted the
On 2015-05-03 14:35, Matthys 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.
Hi Erik,
Thanks for your reply.
I'm aware of the problems with timedelta(months=2), since the length of a
month is not fixed, a length of time specified in months is ambiguous.
Though months do have an internally consistent algebra as you point out and
people often refer to time-periods in month
> Den 04/05/2015 kl. 14.21 skrev Erik Cederstrand :
>
> class Month(models.Model):
>year = models.IntegerField()
>month = models.PositiveSmallIntegerField()
>
>def add_months(self, n):
>assert n >= 0
>dy, dm = divmod(self.month + n, 12)
>
> Den 04/05/2015 kl. 13.26 skrev Matthys Kroon :
>
> I'm specifically looking at only situations where the year and month alone
> are significant.
>
> The downside I see with using a DateField and forcing the day to the first of
> the month, with custom widget etc. is that
Hi,
I'm specifically looking at only situations where the year and month alone
are significant.
The downside I see with using a DateField and forcing the day to the first
of the month, with custom widget etc. is that somebody looking at the
database may not realize that something unusual is
On 4/05/2015 12:31 PM, Tom Lockhart wrote:
Surely that would destroy data which wouldn’t be desirable.
I’m not sure how that follows.
If you are adjusting a date from whatever it actually is to the first of
the month you lose the actual date.
Although the question does not state
it
On May 3, 2015, at 7:17 PM, Mike Dewhirst wrote:
> On 4/05/2015 11:41 AM, Tom Lockhart wrote:
>> On May 3, 2015, at 2:35 PM, Matthys wrote:
>>
>>> I posted the question also on stackoverflow:
>>>
>>>
On 4/05/2015 11:41 AM, Tom Lockhart wrote:
On May 3, 2015, at 2:35 PM, Matthys 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
On May 3, 2015, at 2:35 PM, Matthys 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
>
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.
--
You received this message because you are
11 matches
Mail list logo