List Info

Thread: User profile and sliding date range data model?




User profile and sliding date range data model?
country flaguser name
United States
2007-03-29 19:28:05
I'm trying to think how I can solve this problem in my data
model and 
I'm coming up empty.  I thought I'd post it here to see if
anyone else 
had a good idea...

I built a members-only website for due paying members.  We'd
like to use 
the profile via the Django admin as a way to track which
members have 
paid their dues.  At first I was looking at a BooleanField
that maybe 
gets cleared at the change of the year.  But then I found
out that:

* Often if a member doesn't pay, the officers won't remove
them from the 
roster right away.  Only if they don't pay for 2-3
consecutive years 
will they remove the member.

* Some members pay ahead a few years, and so that would need
to be tracked.

I can't think of a way to account for "up to last 3
years" and "up to 
the next 5 years" or variation thereof.

Any ideas would be much appreciated.

Thanks,
Rob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: User profile and sliding date range data model?
user name
2007-03-29 20:32:58
On 3/29/07, Rob Hudson <treborhudsongmail.com> wrote:
> I can't think of a way to account for "up to last
3 years" and "up to
> the next 5 years" or variation thereof.

paid_up_until = models.DateField()

Then use Python's standard 'datetime.timedelta' to handle
offets;
e.g., if a member pays up for the next three years:

p = user.get_profile()
p.paid_up_until += datetime.timedelta(days=3*365)
p.save()

-- 
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: User profile and sliding date range data model?
country flaguser name
United Kingdom
2007-03-30 03:21:30

On 30 Mar 2007, at 2:32 am, James Bennett wrote:

>
> On 3/29/07, Rob Hudson <treborhudsongmail.com> wrote:
>> I can't think of a way to account for "up to
last 3 years" and "up to
>> the next 5 years" or variation thereof.
>
> paid_up_until = models.DateField()
>
> Then use Python's standard 'datetime.timedelta' to
handle offets;
> e.g., if a member pays up for the next three years:
>
> p = user.get_profile()
> p.paid_up_until += datetime.timedelta(days=3*365)
> p.save()

One of the things that annoys me about datetime is that it
doesn't  
handle leap years properly. However, if you use
python-dateutil[1] it  
has a relativedelta so you can do things like:

 >>> datetime.date.today()+relativedelta(years=+3)
datetime.date(2010, 3, 30)

.. which will take into account leap years too.

-- 
David Reynolds
davidreynoldsfamily.org.uk



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: User profile and sliding date range data model?
country flaguser name
United Kingdom
2007-03-30 03:27:07

On 30 Mar 2007, at 9:21 am, David Reynolds wrote:

>
> One of the things that annoys me about datetime is that
it doesn't
> handle leap years properly. However, if you use
python-dateutil[1] it
> has a relativedelta so you can do things like:
>
>>>>
datetime.date.today()+relativedelta(years=+3)
> datetime.date(2010, 3, 30)
>
> .. which will take into account leap years too.
>

Woops, forgot to say:

[1] http://labix.org/pyt
hon-dateutil

-- 
David Reynolds
davidreynoldsfamily.org.uk



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: User profile and sliding date range data model?
country flaguser name
United States
2007-03-30 11:01:23
James Bennett wrote:
> On 3/29/07, Rob Hudson <treborhudsongmail.com> wrote:
>> I can't think of a way to account for "up to
last 3 years" and "up to
>> the next 5 years" or variation thereof.
> 
> paid_up_until = models.DateField()
> 
> Then use Python's standard 'datetime.timedelta' to
handle offets;
> e.g., if a member pays up for the next three years:
> 
> p = user.get_profile()
> p.paid_up_until += datetime.timedelta(days=3*365)
> p.save()

That's a good idea.  I'm thinking that once I implement that
some user 
is going to have a gap in their dues... like maybe they paid
in 05, 
skipped 06, and paid 07.  I think the club officers want to
track that.

I had a thought that maybe this could just be tied to
another table 
called paid_dues, with a user_id and years paid for.

But if Members has a FK to Users, would my Dues model be
tied to Users 
or tied to Members?  I'll have to play with that and see how
it renders 
out in the admin.

Thanks for the ideas.

-Rob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )