On Mon, Jul 18, 2011 at 10:54 PM, Andre Terra <andrete...@gmail.com> wrote:
> Hello, django-users. > > I'm in need of some serious help on deciding how to design my next project. > Below is my attempt to describe the use case: > > *USE CASE* > I'm writing an accounting app that will be generating unique monthly > reports of the revenue results for a list of Accounts (model) in the > company. > > Each Account has a set of instances of Entry (model) with a Decimal value, > date and some text, as well as a FK to Account. > > These entries are uploaded through an (already coded) import function which > parses a .csv and, using DSE, inserts 1.5 million rows to the Entry table. > These entries also have an FK to Task (model) so I know which import process > generated them. > > Each month I want to allow an admin to pick a set of Accounts to be > displayed in the monthly report, which needs to be unique for obvious > reasons. > > *CODE > models.py > *http://dpaste.com/hold/570933/ > > *example .csv file to be imported* (importing the file is already coded > and works 100% so far)* > *http://dpaste.com/hold/570934/* > * > *QUESTIONS* 1. Should I create another model named MonthlyReport with an M2M relation to > Accounts, and then add an 'is_active' flag so I know which one is the > official monthly report? Hi Andre, Could you elaborate a little more about the monthly reports? The admin pick up some arbitrary number of accounts and the app generates a global report for those accounts? or it should generate a discret report for each account? 2. If so, how can I ensure there's only one official monthly report? Perhaps > setting is_active to False to all the other MonthlyReports that carry the > same month/year? > what's the difference between "official monthly report" and "unofficial" monthly record? > 3. How should I prevent users from importing the Entries more than once? > Forcing a deletion of entries for the same month as the imported entries is > a possible solution.. The .csv file should always be restricted to a single > month, but I guess I could write a check for that too, or expand the > deletion for every matching month. As you say, when a user upload a csv file you could check if your db already contains entries for the same month and if so, display a confirmation page warning the user that someone already uploaded the csv for the current month and if it's ok to delete the entries of the previous importat. (show some details: user/date/csv version|name/#entries and so on) . > -- Marc -- 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.