@George
great question.  In a very long ago php implementation of something
similar with Access as a backend, I simply queried the date range in
question, and built up an array, then walked through that while
building the html table.  It was ugly and even had some queries right
in along the tr/td tags to go look up what was budgeted for that
particular task and coloured the row accordingly for over/under
budget.  All accomplished in one big ole procedural ugly php file
without any separation of logic and content.  In another environment
with Cold Fusion and Informix as the db, a not too complex single sql
statement handled it all with case statements, and a bit of a custom
informix function/stored procedure handling the totals versus
budgeted.  In the informix implementation calls to the database were
'expensive' so attempts were made to do everything in a single sql
statement where possible.

So I'm open to what would be the sort of best practice taking
advantage of python's strengths along with a mysql db, keeping in mind
that that the db may switch to postgresql at some point (trying to
stay away from non-standard sql calls).

@Lars
I like the idea of the a function like get_week as that allows for
future needs like get_month, get_day ....

if I have something like
start_date = datetime.date(2009, 5, 3)
end_date = datetime.date(2009, 5, 9)
Timecard.objects.filter(start__range=(start_date, end_date))

my question is more of the what is the best approach to take to then
display the data outlined in the original post.  I provided the model
and the specific implementation as it seems that lots of times that
information gets requested instead of the generic details.

The more I read through the documentation, the more I find very
specific functions which could make life very simple.  Having no real
experience with Python outside of following along with tutorials, I am
asking here for advice.  Is there an 'absolute beginner' section where
this would be better posted?  If I want to put the week at a time into
python structure, which structure would be recommended, should I let
the db sort the data or not bother and build the equivalent of an
multi-dimensional array, then sort it?  It wouldn't surprise me that
someone has a function already written (I've looked on djangosnippets)
which does just this which I could use as a starting point.

I do not want to change the model for this presentation requirement.
Everything else is much easier with the model in this way.  The
timecards will be subsequently be sent to a journal table, used for
billing/cost analysis.  Being able to bring up detail for a particular
day in the timecard table without the rest of the week as well has
served quite well.  The supervisor approval process will also be able
to reject a particular entry for a particular task while allowing
everything else for that pay period - the current model allows for
that (along with some other tables).  Having a whole week of time
delayed for billing would not work out for this implementation.  I
appreciate the suggestion though.  I'm also planning on pulling in a
few years worth of data which is currently stored in a very similar
format - would love to keep that process as easy as possible.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to