Re: Component design question

2019-06-20 Thread J. Pic
Damnit, my port was wrong above, here goes, with list for content and dict for attributes as arguments instead of using *args, **kwargs: if not request.user.is_authenticated: content.append( Li( [A([_('Log in')],

Re: Component design question

2019-06-20 Thread J. Pic
Better for perspective to port the first example in second syntax to compare: if not request.user.is_authenticated: content.append( Li( A([_('Log in')], dict(href=reverse('crudlfap:login'))), dict(cls='no-padding'),

Component design question

2019-06-20 Thread J. Pic
Hi all, We're running some experiments replacing templates by Components (which support channels based data-binding amongst other niceties) in Python, i would like to run an opinion survey about two syntaxes before moving on. Syntax 0 is what seems more "pythonic" but requires a less strict call

Re: Celery/Redis Django 2.0 Design Question

2018-10-28 Thread hunter.cur...@gmail.com
I think you are on the right track. I am doing something similar with photos and gps tracks uploaded by users and the celery/redis combo makes it easy to run a compute intensive task without blocking the site. I'm not sure if the celery-signals approach is strictly necessary, however. I am

Celery/Redis Django 2.0 Design Question

2018-10-27 Thread Mark Phillips
I am building a django 2.x site to: * upload documents (images, pdfs, and videos) * apply metadata to the documents (JSON metadata field) * transform the documents (thumbnails, OCR, language translations, image conversion, facial recognition, image blurring, etc.) based on some of the metadata

Re: Model design question

2017-06-25 Thread Mark Phillips
On Sun, Jun 25, 2017 at 6:56 PM, Constantine Covtushenko < constantine@gmail.com> wrote: > Hi Mark, > > I have some questions to you. > 1. Does any of MetaData have predefined list of MetaDataValues? > No, I want to add them in real time as Documents are uploaded. > 2. Can MetaDataValue be

Re: Model design question

2017-06-25 Thread Constantine Covtushenko
Hi Mark, I have some questions to you. 1. Does any of MetaData have predefined list of MetaDataValues? 2. Can MetaDataValue be assigned to many Documents or it is specific to particular Document? Regards, Constantine C. On Sun, Jun 25, 2017 at 6:20 PM, Mark Phillips

Model design question

2017-06-25 Thread Mark Phillips
I have a class Document that uploads a document. I have a class MetaData that is the name for some metadata for that document. Since a MetaData can have one or more values, there is another class called MetaDataValue that has a ForeignKey to MetaData. Finally, there is a class

Re: DB Design question

2015-08-01 Thread Javier Guerra Giraldez
On Sat, Aug 1, 2015 at 4:53 AM, James Schneider wrote: > If you are talking about potentially having enough rows to extend past the > AutoPK limits, you should consider instead using a UUID field as the PK: note that this is only good advice if your DB handles it

Re: DB Design question

2015-08-01 Thread James Schneider
If you are talking about potentially having enough rows to extend past the AutoPK limits, you should consider instead using a UUID field as the PK: https://docs.djangoproject.com/en/1.8/ref/models/fields/#uuidfield The example in the docs uses UUID4. They index nicely and there are 2^128 (~3.4 x

Re: DB Design question

2015-08-01 Thread Stephen J. Butler
Why not use a BigIntegerField? On Sat, Aug 1, 2015 at 12:06 AM, jordi collell wrote: > Hi all! > > I have to store spreadsheet info on a db. Some kind of quotes where the > user can store distinct prices for every zone. > > After modeling the data, i have a Cell like row.

DB Design question

2015-08-01 Thread jordi collell
Hi all! I have to store spreadsheet info on a db. Some kind of quotes where the user can store distinct prices for every zone. After modeling the data, i have a Cell like row. (related to a zone, and with a quantity field).. something like: zone1 1 100 zone1 2 99 zone1 3 98 Every zone

Re: Design question: Is it really a good idea for models having “side effects”?

2015-02-20 Thread Russell Keith-Magee
On Fri, Feb 20, 2015 at 4:23 PM, Gergely Polonkai wrote: > Hello, > > I’m currently implementing a finite state machine in my application using > Django FSM[1]. In the Usage section of the README the author said that > “This function may contain side-effects, like updating

Re: Design question: Is it really a good idea for models having “side effects”?

2015-02-20 Thread Vijay Khemlani
I'm not sure if there's an official stance on that, but I believe that since Django is a "MVT" framework, that kind of logic does not seem to be appropiate neither for templates nor views, so models seem like the logical choice. That way you can also make sure that the side-effect that you want

Design question: Is it really a good idea for models having “side effects”?

2015-02-20 Thread Gergely Polonkai
Hello, I’m currently implementing a finite state machine in my application using Django FSM[1]. In the Usage section of the README the author said that “This function may contain side-effects, like updating caches, notifying users, etc.” Opposing this statement, the Symfony PHP framework’s

Re: Overall Design Question

2013-02-11 Thread Gabriel Abdalla
Hi Alex, I'm still new to Django and Python, but I have experience in other frameworks. Here is my opinion regarding your three points: *(1) An app for each role.* I think the approach of having one app for each role is the worst thing to do. In this case, you would have too much duplicated code

Re: Overall Design Question

2013-02-11 Thread Bill Freeman
On Mon, Feb 11, 2013 at 7:13 AM, Ajinkya Gadewar < ajinkya.gade...@ishareitall.com> wrote: > Hi Alex, > > I already have a education system developed. We run a software company in > India. Let me know if you need more details on it. > > Regards, > Ajinkya Gadewar > > Sent from my iPhone > > On

Re: Overall Design Question

2013-02-11 Thread Ajinkya Gadewar
Hi Alex, I already have a education system developed. We run a software company in India. Let me know if you need more details on it. Regards, Ajinkya Gadewar Sent from my iPhone On 11-Feb-2013, at 2:17 PM, "alexandre...@gmail.com" wrote: > Hi > I'm starting a big

Overall Design Question

2013-02-11 Thread alexandre...@gmail.com
Hi I'm starting a big app on Django for Shool management, to replace a Win32 app. I've roles like teachers, students, admin stuff, ... that have diferent access. How should it be developded? 1- an app for each role? 2- some logic in templates? 3- any other what is the correct aporach to get

Re: Model design question

2012-05-18 Thread oneroler
Mike, Anssi, Thank you for your replies. I will give this a shot and see if I can get it to work. Sam On Thursday, May 17, 2012 9:59:40 PM UTC-7, akaariai wrote: > > On May 18, 5:25 am, oneroler wrote: > > Thanks Mike, that is what I was originally planning to do but

Re: Model design question

2012-05-17 Thread akaariai
On May 18, 5:25 am, oneroler wrote: > Thanks Mike, that is what I was originally planning to do but realized > there would be situations where that wouldn't do exactly what I wanted. > For example, if there is a business that only has the strategy 'wholesale' > assigned,

Re: Model design question

2012-05-17 Thread Mike Dewhirst
On 18/05/2012 12:25pm, oneroler wrote: Thanks Mike, that is what I was originally planning to do but realized there would be situations where that wouldn't do exactly what I wanted. For example, if there is a business that only has the strategy 'wholesale' assigned, using ForeignKey would

Re: Model design question

2012-05-17 Thread oneroler
Thanks Mike, that is what I was originally planning to do but realized there would be situations where that wouldn't do exactly what I wanted. For example, if there is a business that only has the strategy 'wholesale' assigned, using ForeignKey would still allow me to assign a different

Re: Model design question

2012-05-17 Thread Mike Dewhirst
On 18/05/2012 7:02am, oneroler wrote: I'm trying to setup my first app and I'm trying to figure out the best way to have constraints on a particular field (strategy for class Division noted below). Below is the basic model structure. What I would like is for the strategy under a Division to

Model design question

2012-05-17 Thread oneroler
I'm trying to setup my first app and I'm trying to figure out the best way to have constraints on a particular field (strategy for class Division noted below). Below is the basic model structure. What I would like is for the strategy under a Division to be constrained to the strategies

Re: Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread Andre Terra
h-magee.com> wrote: > > On Mon, Nov 7, 2011 at 8:06 PM, youpsla <youp...@gmail.com> wrote: > > > Hi, > > > before getting more in depth in writing my project I ask you a general > > > design question. My Django knowledge is not BIG enough for me to be &

Re: Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread youpsla
<russ...@keith-magee.com> wrote: > On Mon, Nov 7, 2011 at 8:06 PM, youpsla <youp...@gmail.com> wrote: > > Hi, > > before getting more in depth in writing my project I ask you a general > > design question. My Django knowledge is not BIG enough for me to b

Re: Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread Russell Keith-Magee
On Mon, Nov 7, 2011 at 8:06 PM, youpsla <youp...@gmail.com> wrote: > Hi, > before getting more in depth in writing my project I ask you a general > design question. My Django knowledge is not BIG enough for me to be > able to have a clear answer (with for and cons) on my

Project general design question - "From scratch" or use of admin interface

2011-11-07 Thread youpsla
Hi, before getting more in depth in writing my project I ask you a general design question. My Django knowledge is not BIG enough for me to be able to have a clear answer (with for and cons) on my question. Here are the main guidelines of my project : - I've two kind of users : Shop owners

Re: Django models design question

2011-10-17 Thread omerd
Thank you very much! I choose the first option for now. If I have any problems, I will write them here On Oct 17, 2:51 pm, Stuart wrote: > Hello Omer -- > > I believe you have two options. You could use the AttributeValue > approach I described earlier. You could add

Re: Django models design question

2011-10-17 Thread Stuart
Hello Omer -- I believe you have two options. You could use the AttributeValue approach I described earlier. You could add features to take care of 'data types' and the like. The work may be quite tedious, but it has the advantage of not being clever. In other words, you would do the work to

Re: Django models design question

2011-10-16 Thread omerd
I should also mention that one AttributeValue table for all the registrations isn't good for my purpose, because it says that the Value column must have a specific type field. I want that every detail (Atrribute) will have the option to be from any field type (CharField,DateTimeField, etc). On

Re: Django models design question

2011-10-15 Thread omerd
Thank you for the response. As stuart wrote, i should give more details about the website. Currently let's suppose I have 2 interesting tables (I'm not sure that the relationship between these 2 tables is well designed): 1. Details, that contains all the possible information that should be

Re: Django models design question

2011-10-14 Thread Stuart
Hello omerd -- If you give some concrete examples of what you are trying to do, including providing your current models.py code, it will make it easier for us to help you. Since you have Registration and Details models, I am assuming you want the user to be able to create/define these items,

Django models design question

2011-10-14 Thread omerd
Hello everybody, I am writing my first web application with Django. I want to create a web of registration for many subjects. However, each subject require different set of details to be supplied so I don't know which models should I have in the database. Currently I have two models:

Re: Database Design Question

2011-07-22 Thread nixlists
On Thu, Jul 21, 2011 at 5:35 PM, Marc Aymerich wrote: > > ups, I think it should be: > contract.products.filter(id=Y).values_list('rebate_pct', flat=True) > product.contractproduct_set.filter(id=X).values_list('rebate_pct', > flat=True) Thanks. The first one does not work

Re: Database Design Question

2011-07-21 Thread Marc Aymerich
On Thu, Jul 21, 2011 at 11:33 PM, Marc Aymerich wrote: > > > On Thu, Jul 21, 2011 at 11:11 PM, nixlists wrote: > >> On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: >> > ContractProduct.objects.all() >> > Following might work

Re: Database Design Question

2011-07-21 Thread Marc Aymerich
On Thu, Jul 21, 2011 at 11:11 PM, nixlists wrote: > On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: > > ContractProduct.objects.all() > > Following might work also (not sure, but is easy to test in shell for > > example): > > for c in

Re: Database Design Question

2011-07-21 Thread nixlists
On Thu, Jul 21, 2011 at 4:30 PM, Jani Tiainen wrote: > ContractProduct.objects.all() > Following might work also (not sure, but is easy to test in shell for > example): > for c in Contract.objects.all(): >     for cp in c.contractproduct_set.all(): >         print c,

Re: Database Design Question

2011-07-21 Thread Jani Tiainen
On Thu, Jul 21, 2011 at 10:50 PM, nixlists wrote: > On Thu, Jul 21, 2011 at 2:17 PM, Jani Tiainen wrote: > > Hi, > > So you want to tie Contract with Product(s) with rebate_pct? You then > need > > custom intermediary m2m table say "ContractProduct" > >

Re: Database Design Question

2011-07-21 Thread nixlists
On Thu, Jul 21, 2011 at 2:17 PM, Jani Tiainen wrote: > Hi, > So you want to tie Contract with Product(s) with rebate_pct? You then need > custom intermediary m2m table say "ContractProduct" >

Re: Database Design Question

2011-07-21 Thread Jani Tiainen
Hi, So you want to tie Contract with Product(s) with rebate_pct? You then need custom intermediary m2m table say "ContractProduct" https://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-manytomany> for more. So in the end your models would probably look a alike following: class

Re: Database Design Question

2011-07-21 Thread newtodjango
Sorry about formatting. Also the there is a mistake. "I'd like to define the Product model..." should be "I'd like to define the Contract model... Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Database Design Question

2011-07-21 Thread newtodjango
Hi. I have a question about writing normalized models. I began writing an app that has non-normalized tables, and would like to rewrite it with a normalized design. I have non-normalized legacy tables like this without foreign keys or many-to-many relationships, which I would like to have.

Model design question

2011-01-22 Thread Yarin miran
Hello everyone I just started with django and was wondering how to do the following behaivor in my models: class Game(models.Model) characters_count = models.IntegerField(default=1) #basically i set to a choice of 1-3 class Match(models.Model) video=models.ForeignKey(Game) p1char1 =

Re: 2D map application: performance and design question

2010-11-04 Thread Lars Ruoff
Excellent advice! With this I'm down to less than 0.02 secs for the 13x13 map rendering! Regards, Lars On Nov 2, 9:45 pm, Knut Ivar Nesheim wrote: > I would suggest rewriting the loop in your template as a templatetag. > Something like this > > @register.simple_tag > def

Re: 2D map application: performance and design question

2010-11-02 Thread Knut Ivar Nesheim
I would suggest rewriting the loop in your template as a templatetag. Something like this @register.simple_tag def render_locations(locations): html = u""" html %(x)s stuff %(y)s here %(link)s """ return '\n'.join([html % { 'x': loc.x, 'y': loc.y', 'link': loc.link } for loc in

Re: 2D map application: performance and design question

2010-11-02 Thread Lars Ruoff
Ok, thanks for the suggestion, Javier. I implemented this and it showed: I'm spending about 0.2 secs for the queries, but 1.5 secs for t.render(c) ! So rendering the template seems to take a significant amount of time! As you can see, my template code iterates over about 13*13=169 objects that

Re: 2D map application: performance and design question

2010-11-02 Thread Javier Guerra Giraldez
On Tue, Nov 2, 2010 at 3:35 AM, Lars Ruoff wrote: > Ok, so having excluded SQLite and the static served files, I'd like to > test if the server matters. What would be a minimum Apache install and > config to run Django locally (on Windows)? again, that's _very_ unlikely to

Re: 2D map application: performance and design question

2010-11-02 Thread Kenneth Gonsalves
On Tue, 2010-11-02 at 01:35 -0700, Lars Ruoff wrote: > Ok, so having excluded SQLite and the static served files, I'd like to > test if the server matters. What would be a minimum Apache install and > config to run Django locally (on Windows)? try nginx+fcgi/tornado/your favourite webserver --

Re: 2D map application: performance and design question

2010-11-02 Thread Lars Ruoff
Ok, so having excluded SQLite and the static served files, I'd like to test if the server matters. What would be a minimum Apache install and config to run Django locally (on Windows)? On Nov 1, 7:30 pm, Lars Ruoff wrote: > Ok, thanks all, > > So following Bill's advice, i

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, thanks all, So following Bill's advice, i did: >python manage.py shell >>> import game.models >>> list(game.models.Location.objects.filter( \ ... x__gte=34, \ ... x__lte=46, \ ... y__gte=24, \ ... y__lte=36)) ...and the result showed up instantly! So it seems DB is not the issue.

Re: 2D map application: performance and design question

2010-11-01 Thread Bill Freeman
My experience with Django debug toolbar is that it makes things slow all by itself. I have done a couple of apps that use the equivalent query, using PostgreSQL, without noticing a performance issue, with everything running on a Linux server. 1. Have you tried timing the query by hand? That is,

Re: 2D map application: performance and design question

2010-11-01 Thread Javier Guerra Giraldez
On Mon, Nov 1, 2010 at 5:55 AM, Cal Leeming [Simplicity Media Ltd] wrote: > 9 out of 10 times, the bottleneck is usually the database true, but 8.7 of those 9 are about how the database is used, and not about the engine choice. simply changing SQLite won't

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Lukasz, see my answer to Daniel. Replacing images by text didn't speed up things much. Is there any other test/profiling that i should do? Would taking the systime before and after the query give me some hints? I'll try this later... On Nov 1, 12:39 pm, Łukasz Rekucki

Re: 2D map application: performance and design question

2010-11-01 Thread Łukasz Rekucki
On 1 November 2010 10:59, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps with Django, and i only have > limited experience with Python, so please be patient. > > I'm using it for what is intended to be a browser game in the future. > The main part of

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Daniel, you are right that images are being loaded. But i gave it a try and replaced the images by text. Still the page takes about 3 seconds to load. Lars On Nov 1, 12:30 pm, Daniel Roseman wrote: > It's a bit hard to tell without knowing how the slowness appears.

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, but that said, the database isn't that big here. (Well, i guess) There are currently 4800 entries in the "Location" table. Is this too much for SQLite already? May it be the query in locations = Location.objects.filter( \ x__gte=center_location.x-half_x, \

Re: 2D map application: performance and design question

2010-11-01 Thread Daniel Roseman
On Nov 1, 9:59 am, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps with Django, and i only have > limited experience with Python, so please be patient. > > I'm using it for what is intended to be a browser game in the future. > The main part of the game

Re: 2D map application: performance and design question

2010-11-01 Thread Cal Leeming [Simplicity Media Ltd]
Hi Lars, Unless you are doing some *really* intense Python code in your business logic, then 9 out of 10 times, the bottleneck is usually the database, especially if you are using Python. Cal On Mon, Nov 1, 2010 at 9:59 AM, Lars Ruoff wrote: > Hello, > > first of all,

2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hello, first of all, these are my first steps with Django, and i only have limited experience with Python, so please be patient. I'm using it for what is intended to be a browser game in the future. The main part of the game is a zoom view on a two-dimensional map of fields. I'm currently using

Re: Database Design Question

2010-06-19 Thread llanitedave
> > > The sample type table is only needed to generate a form for new samples. > >  The attribute table could be broken up by data type if necessary as well. > > > Sent from my Verizon Wireless BlackBerry > > > -Original Message- > > From: llan

Re: Database Design Question

2010-06-19 Thread S Basl
well. > > Sent from my Verizon Wireless BlackBerry > > -Original Message- > From: llanitedave <llanited...@veawb.coop> > Date: Fri, 18 Jun 2010 23:27:55 > To: Django users<django-users@googlegroups.com> > Subject: Re: Database Design Question > > Th

Re: Database Design Question

2010-06-19 Thread srbasl
from my Verizon Wireless BlackBerry -Original Message- From: llanitedave <llanited...@veawb.coop> Date: Fri, 18 Jun 2010 23:27:55 To: Django users<django-users@googlegroups.com> Subject: Re: Database Design Question Thanks for the response, Venkatraman. You're right that I don

Re: Database Design Question

2010-06-19 Thread Torsten Bronger
Hallöchen! llanitedave writes: > [...] > > I guess it's mostly a normalization question. > > And while I was typing out a long explanatory discussion to > enlarge on the problem, I stumbled across the answer. > > I'll need to use a separate table for each sample type to store > its unique set of

Re: Database Design Question

2010-06-19 Thread llanitedave
Thanks for the response, Venkatraman. You're right that I don't anticipate a huge number of records here -- a few hundred thousand at the extreme high end. Sharding isn't something I considered, and I don't think it would be necessary. I guess it's mostly a normalization question. And while I

Re: Database Design Question

2010-06-18 Thread Venkatraman S
On Sat, Jun 19, 2010 at 10:12 AM, Venkatraman S wrote: > Prefer a table like follows (tblname:samples): sampleid, samplename , > sampledesc etc etc > Ok - i missed explaining why i would recommend this: In most of the applications, maintainence is a bigger pain than

Re: Database Design Question

2010-06-18 Thread Venkatraman S
On Sat, Jun 19, 2010 at 4:28 AM, llanitedave wrote: > I'm putting together a system to track scientific samples of various > types. The "various types" is what's making me scratch my head at the > moment. > Prefer a table like follows (tblname:samples): sampleid,

Database Design Question

2010-06-18 Thread llanitedave
I'm putting together a system to track scientific samples of various types. The "various types" is what's making me scratch my head at the moment. Each sample type has a particular set of attributes, some of which are unique, others are shared with other sample types. For example, a fluid

Re: design question - forms as meta-data to a model

2010-06-06 Thread Walter Wefft
On Jun 6, 5:23 am, Jason Beaudoin wrote: > >  - I've got a model that defines "submissions", which are incoming > messages from HTML forms on various websites and are fielded by admins >  - each submission has a bunch of basic information related to the > submission

Re: design question - forms as meta-data to a model

2010-06-06 Thread Sam Lai
In the SQL world, you would probably store each form field value for each submission as a row (or the entire form submission in a single field, serialized to some known form; some DBs natively have an XML field which might be useful). In the noSQL world, however, this kind of situation is easier

Re: design question - forms as meta-data to a model

2010-06-06 Thread Russell Keith-Magee
On Sunday, June 6, 2010, Jason Beaudoin wrote: > On Fri, Jun 4, 2010 at 2:42 AM, Russell Keith-Magee > wrote: >> On Fri, Jun 4, 2010 at 12:03 PM, Jason Beaudoin >> wrote: >>> Silence usually implies some key piece of

Re: design question - forms as meta-data to a model

2010-06-05 Thread Jason Beaudoin
On Fri, Jun 4, 2010 at 2:42 AM, Russell Keith-Magee wrote: > On Fri, Jun 4, 2010 at 12:03 PM, Jason Beaudoin > wrote: >> Silence usually implies some key piece of documentation was missed, or >> was this just lost amongst more interesting posts?

Re: design question - forms as meta-data to a model

2010-06-04 Thread Russell Keith-Magee
On Fri, Jun 4, 2010 at 12:03 PM, Jason Beaudoin wrote: > Silence usually implies some key piece of documentation was missed, or > was this just lost amongst more interesting posts? :) You've missed two important alternatives: * The people who can answer your question

Re: design question - forms as meta-data to a model

2010-06-03 Thread Jason Beaudoin
Silence usually implies some key piece of documentation was missed, or was this just lost amongst more interesting posts? :) On Tue, Jun 1, 2010 at 9:54 PM, Jason Beaudoin wrote: > Hi, > > I've a situation where the following functionality is desirable.. > >  - one

design question - forms as meta-data to a model

2010-06-01 Thread Jason Beaudoin
Hi, I've a situation where the following functionality is desirable.. - one central model is used and interacted with by users - forms (multiple on multiple sites, pick a number for each.. 5 or 50, doesn't matter) are submitted by anonymous users and associated with this central model.. so

Re: Templates design question

2010-02-15 Thread andreas schmid
you could create a template module where you put in the logic to dipslay the content of the post: Hello, > > I'm writing some simple webblog, just for self teaching, and I have a > question how to do better. Here is the situation, I have base.html, I > have blog.html which extends base. Now

Templates design question

2010-02-15 Thread R. K.
Hello, I'm writing some simple webblog, just for self teaching, and I have a question how to do better. Here is the situation, I have base.html, I have blog.html which extends base. Now in that blog I would like to put posts, full text posts, without comments, and link to the post only with

Model design question: Inheritance? GenericRelation? ...?

2010-02-10 Thread Achim Domma
Hi, I have different models A,B,C which all will have exactly on Address. If I query instances of A,B,C I usually will also need the related address. I also want to query all instances of A,B,C which have a certain zip code for example. What's the best and most efficient way to model that in

Re: Design Question - Extending a model

2010-01-12 Thread Jason Beaudoin
On Mon, Jan 11, 2010 at 12:00 PM, Igor wrote: > Thanks a lot - I didn't know about generic relations, and will > definitely look at them - right now :). I start thinking about extending models (and other DRY mode/db methods) when I see myself repetitively typing out

Re: Design Question - Extending a model

2010-01-11 Thread Igor
Thanks a lot - I didn't know about generic relations, and will definitely look at them - right now :). The minimal subset - and that's where I'm trying to follow DRY - boils down to a Title, a slug, Content HTML of the entry, maybe a couple more things - all are very much like what you would

Re: Design Question - Extending a model

2010-01-11 Thread Ethan Jucovy
My instinct is that you may be trying to be too generic. Without knowing more details, a "generic Entry" sounds a lot like .. a database record. :) Django's model.Model base class already does a great job at being easily extensible. Is there a specific minimal-but-interesting set of database

Design Question - Extending a model

2010-01-11 Thread Igor
Hi all, This is a general question for whoever is good with best practices for Django design (software design that is). I'd like to implement (well, kinda have implemented), a generic Entry object that would be good for several uses. For example, an Event (such as, say, a website presentation)

Re: design question: storing history

2009-12-14 Thread Shawn Milochik
It sounds like, for auditing purposes, there should be a model for storing each "hours worked" entry. Also, the hours estimated should not be reduced in the database -- there should be a method of your model which returns the remaining hours by subtracting the sum of the worked hours from the

design question: storing history

2009-12-14 Thread tom
Hi, I have a Model which tracks tasks for a project. This model should have - hours estimated - hours worked on it. Everytime someone updates one of those fields, the hours worked should be increased and should also be stored to be used for time reporting. e.g. hours worked: 12.21.09 2 hours,

Re: A Design Question

2009-12-01 Thread John M
Even though it is outside the scope, I'd say start simple and build slowly with related tables, those are easy to add to a system. I'd probably find the attributes you'd like to capture in the 'extra details' and start putting them in a table. Determine what the purpose of these attributes are,

Re: A Design Question

2009-11-29 Thread Steve S.
This /is/ outside the scope of Django. "Database normalization" and "Database design" are the google query you're looking for to learn more about this, though. Here are some links that may steer you in the right direction: http://en.wikipedia.org/wiki/Database_normalization

A Design Question

2009-11-29 Thread Ramdas S
This is probably outside Django. But I am checking out since I am building it with Django. I am building a specialized closed group social networking web site for special set of medical practitioners. Idea for my client is to be a mini- LinkedIn of sorts for this small community. We want to

Re: Design question

2009-09-24 Thread Brian McKeever
It's a trade-off. Loose coupling allows you to modify the structure of your program easier, but doing so in this case is going to lead to a performance hit. That said, this isn't crazy coupling we're suggesting. It's not like we need to know anything about the user model to do this or that

Re: Design question

2009-09-24 Thread ringemup
So the tighter coupling implied by each entry knowing about the user profile shouldn't be a subject of concern? On Sep 23, 11:05 pm, Brian McKeever wrote: > I remember a quote from either headfirst java or design patterns that > said something like: > "The key to inheritance

Re: Design question

2009-09-23 Thread Brian McKeever
I remember a quote from either headfirst java or design patterns that said something like: "The key to inheritance is to abstract functionality." I realize we're not talking about inheritance, but I think it still applies. It may make logical sense that a user object has a blog that has

Design question

2009-09-21 Thread ringemup
There's a pattern I keep running into, and I've been wondering if anyone who's encountered it before has an opinion on how best to deal with it: Imagine you have an app that could theoretically stand on its own -- for now let's say a schedule, but it could be anything (an image gallery, a blog,

Re: Design question: User vs. UserProfile

2009-09-18 Thread Léon Dignòn
The user model, because the model defined by AUTH_PROFILE_MODULE is intended to be an extension to the actual user model. Namely the profile. Why would you bind something to a user's profile, instead of the user itsself? If you want to "allow records of people without Users", then use blank=True

Re: Design question: User vs. UserProfile

2009-09-18 Thread Tiago Serafim
I`d go with the first. It`s easier to get the current logged in user and all other pluggable apps use User, so it's a common thing to do and you can integrate things easily . --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Design question: User vs. UserProfile

2009-09-18 Thread Grant Livingston
I'm still making my first site with django so I don't how much weight my opinion has, but I used a seperate profile for ForeignKeys. I don't know why, it just seemed logical at the time. It is easer as you can refer to whats in a users profile easier. You can put things like {{

Re: Database design question

2009-08-19 Thread ringemup
Validation turns out to be well-nigh impossible using parent / child aliases, but pretty easy with parent / child accounts. Here's what I've ended up with: class Account(models.Model): user = models.ForeignKey(User, unique=True, null=True, blank=True) alias =

Re: Database design question

2009-08-19 Thread ringemup
I'm not asking as a Django / foreign key thing. I'm having a lot of trouble referencing each model from the other's save method for validation purposes, because there's always going to be one that's declared after the other. On Aug 19, 10:35 am, Joshua Russo wrote: >

Re: Database design question

2009-08-19 Thread Joshua Russo
You can, it just creates headaches. At least one of the ForeignKeys needs to not be required (I believe that's the default anyway). On Wed, Aug 19, 2009 at 1:27 PM, ringemup wrote: > > > Is having two classes that reference one another just simply something > that can't be

Re: Database design question

2009-08-19 Thread ringemup
Is having two classes that reference one another just simply something that can't be done in Python? On Aug 19, 4:36 am, Joshua Russo wrote: > On Tue, Aug 18, 2009 at 11:04 PM, ringemup wrote: > > > Well, I'm trying to implement parent / child

Re: Database design question

2009-08-19 Thread Joshua Russo
On Tue, Aug 18, 2009 at 11:04 PM, ringemup wrote: > > Well, I'm trying to implement parent / child aliases, but I'm running > into problems with class declaration order because I need to reference > the Alias class from within the Account class as well as referencing > Account

  1   2   >