Re: Model Design

2022-05-06 Thread Lunga Baliwe
Also/maybe if you haven't please check https://django-import-export.readthedocs.io/en/latest/ On Thu, May 5, 2022 at 3:59 PM 'David Turner' via Django users < django-users@googlegroups.com> wrote: > We receive the data every two weeks and then use django-import-export to > import the data into ou

Re: Model Design

2022-05-05 Thread Ayser shuhaib
It shouldn’t impact cause you can set that field to be (blank=True, null=True) in this case it won’t raise an error and you can attach the imported data to the related account manager. This is how I see it I hope this helps On Thu, 05 May 2022 at 15:59, 'David Turner' via Django users < django-use

Re: Model Design

2022-05-05 Thread 'David Turner' via Django users
We receive the data every two weeks and then use django-import-export to import the data into our database. There is no mention of the account manager in these as this is something on our side. Am I missing the point in that by having the foreign key to the account manager this would impact on t

Re: Model Design

2022-05-05 Thread Ayser shuhaib
To help understand more the problem, would you please explain why adding an extra field to your models to be used as a foreign key, is not an option? On Thu, 05 May 2022 at 15:36, 'dtdave' via Django users < django-users@googlegroups.com> wrote: > We receive data from various third parties in the

Re: Model Design

2022-05-05 Thread Agnese Camellini
i would decouple the importing of data from the database architecture, and make a meaningfould structure of the models, but your own, not the one of the client. In this manner you create a design that is meaningful and can be scaled from the knowledge expressed in the data without being dependant f

Re: Model Design Questions

2017-12-22 Thread Mark Phillips
Thanks for the feedback! For James, the reference to MongoDB is very interesting. The more I looked into MongoDB, I am thinking it is just what I need for this project, since the db stuff is still so fluid. There is (was?) a django interface for MongoDB, at https://django-mongodb- engine.readthed

Re: Model Design Questions

2017-12-17 Thread James Schneider
On Dec 16, 2017 4:46 PM, "Mark Phillips" wrote: I am building an electronic document management system using django and mysql. The purpose of this system is to catalog and retrieve electronic documents. There is no inventory of the physical documents. There are about 3,000 documents (photos, pdfs

Re: Model Design Questions

2017-12-17 Thread Jani Tiainen
Hi, As suggested using Postgres as a database backend would give you first class support for JSON field with ability to query by attributes in JSON data. See https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#jsonfield for more info. 17.12.2017 2.46 "Mark Phillips" kirjoitti:

Re: Model Design Questions

2017-12-16 Thread Matemática A3K
I use https://github.com/dmkoch/django-jsonfield for storing metadata and works very well, the only problem that I see in using one jsonfield for all the metadata you have for a document is searching (which I don't need). 3k, 6k or 9k of rows is "nothing" for MySQL or Postgres, a bottleneck won't

Re: Model Design Questions

2017-12-16 Thread Dan Tagg
If you switched to Postgres you could use a json data type or dictionary data type. Django 1.11 onwards supports the storage and retrieval of both types I believe. Dan On Sun, 17 Dec 2017 at 07:46, Mark Phillips wrote: > I am building an electronic document management system using django and >

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 wrote: > I have a class Doc

Re: Model Design, Nesting by Year

2014-04-29 Thread Venkatraman S
Why not have separate models for Event and Season and then use an intermediate table to capture the M2M between event occurrences and Person. On Thu, Apr 24, 2014 at 12:43 AM, Christopher Grande wrote: > I'm in the process of designing an internal system and I'm having trouble > designing the mo

Re: Model Design: Adding Params to Relationship FIelds

2013-11-21 Thread Thomas Murphy
Thanks Daniel! I try to always RTFM, but this slipped by me. On Thu, Nov 21, 2013 at 5:32 AM, Daniel Roseman wrote: > On Wednesday, 20 November 2013 22:49:28 UTC, Thomas Murphy wrote: >> >> Hi all, >> >> I'm working on a hour-reporting system. >> >> Each Project has many Users, and each User has

Re: Model Design: Adding Params to Relationship FIelds

2013-11-21 Thread Daniel Roseman
On Wednesday, 20 November 2013 22:49:28 UTC, Thomas Murphy wrote: > > Hi all, > > I'm working on a hour-reporting system. > > Each Project has many Users, and each User has many Projects(These are > established and working nicely). > > My design issue is this: > How can I assign each User an I

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 realized > > there woul

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, using ForeignKey would sti

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 stil

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 strate

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 b

Re: Model design graphically or UML

2010-05-23 Thread Jasper Kennis
Visual paradigm is nice, and free for personal use. On May 23, 11:05 am, Jon wrote: > Hello, > > Trying to include some graph tool for managing and sharing data models > visually. > > Testes mysql workbench, dia, graphivz and recently read some about > argoUML.. > > ¿Do you know and recommend any

Re: model design and derived classes - need advice please?

2010-02-02 Thread Tomasz Zieliński
On 2 Lut, 16:06, Simon Davies wrote: > Hi > > I am writing a web shop.  I have a shopping cart class, which has a > many to many relationship to an item class, the item class has three > derived classes.  The basic schema is shown below: > > class Item(models.Model): >         title = models.CharF

Re: model design problem

2009-12-07 Thread Bill Freeman
Or there's overriding the metaclass... On Mon, Dec 7, 2009 at 12:39 PM, Bill Freeman wrote: > Hmmm.  Probably just as ugly, and untested, but: > > class A(basemodel): >    for o in range(MAXNUMREDPORTS): >         for i in (1,2): >             locals()["Port%d_redfield%d" % (o+1, i)] = models.Flo

Re: model design problem

2009-12-07 Thread Bill Freeman
Hmmm. Probably just as ugly, and untested, but: class A(basemodel): for o in range(MAXNUMREDPORTS): for i in (1,2): locals()["Port%d_redfield%d" % (o+1, i)] = models.FloatField() ... On Mon, Dec 7, 2009 at 12:10 PM, Daniel Goertzen wrote: > Okay, I explored model gener

Re: model design problem

2009-12-07 Thread Bill Freeman
Unless I'm very confused, django will happily delete your related objects (since they don't have anything to relate to anymore). Many to many would be more problematic. As far as creating a set of ports, you were stuck with that anyway, if I understand your original approach correctly. Even if y

Re: model design problem

2009-12-07 Thread Preston Holmes
On Dec 7, 8:56 am, Daniel Goertzen wrote: > Thanks for the reply Bill.  The problem I had with that approach is that > after creating the product I have to worry about creating red and green > ports.  Likewise, upon deletion, I have to mop up the ports.  Looking > through the documentation, I di

Re: model design problem

2009-12-07 Thread Daniel Goertzen
Okay, I explored model generation a bit and found an approach that wasn't too offensive. For those that are trying to solve the same problem that I am, here is what I came up with: def red_port(prefix): return """ %(prefix)sredfield1 = models.FloatField() %(prefix)sredfield2 = models.FloatFie

Re: model design problem

2009-12-07 Thread Daniel Goertzen
Thanks for the reply Bill. The problem I had with that approach is that after creating the product I have to worry about creating red and green ports. Likewise, upon deletion, I have to mop up the ports. Looking through the documentation, I did not find a way to bury this behavior in the Model.

Re: model design problem

2009-12-07 Thread Bill Freeman
I'm not clear on what you need to store, so I'll assume that you have individual data to store for each port of each type, and it is unrelated to data stored for another instance of the same or a different product. What comes to mind is that there is a "Product" model and a "Port" model (or if red

Re: model design problem

2009-12-07 Thread Daniel Goertzen
Each port would have about a half-dozen fields, and different port types are totally different from one another. I won't be querying port fields. I've thought about your JSON field trick before, but not with the nice wrapper methods. Good idea, thanks! The solution does have flaws, but if nothi

Re: model design problem

2009-12-07 Thread Shawn Milochik
What kind of information will the database have to store about the ports themselves? How will you need to be able to filter querysets by information in the port fields, if at all? I'm going to throw this one solution out there, but depending on your needs it may not fit: Create a red_ports co

Re: Model design

2009-10-29 Thread Caisys
Dear Vinicius, What is the difference between: -- def __unicode__(self): return unicode(self.place)+' - '+self.nome -- and -- def __unicode__(self): return self.place+' - '+self.nome -- because the both seem to work and display the same inf

Re: Model design

2009-10-26 Thread Daniel Roseman
On Oct 25, 11:47 pm, Caisys wrote: > Thanks but I am not very familiar with forms yet I barely managed to > override the default form. > However, I thought that its ok for the time being since places and > subplaces are not changed frequently so i can live with it for the > time being and move to

Re: Model design

2009-10-26 Thread Vinicius Mendes | meiocodigo.com
def __unicode__(self): return unicode(self.place)+' - '+self.nome On Oct 25, 8:47 pm, Caisys wrote: > Thanks but I am not very familiar with forms yet I barely managed to > override the default form. > However, I thought that its ok for the time being since places and > subplaces are not cha

Re: Model design

2009-10-25 Thread Caisys
Thanks but I am not very familiar with forms yet I barely managed to override the default form. However, I thought that its ok for the time being since places and subplaces are not changed frequently so i can live with it for the time being and move to more important parts until I am more familiar

Re: Model design

2009-10-25 Thread Vinicius Mendes | meiocodigo.com
On Oct 25, 4:53 am, Caisys wrote: > > Just override the form in the inlne admin. All you have to do is set a > > default in the field you want. > > I managed to do that but now all the extra fields have the default > text not just one. > What about overriding the formset? You override the __init

Re: Model design

2009-10-25 Thread Caisys
> Just override the form in the inlne admin. All you have to do is set a > default in the field you want. I managed to do that but now all the extra fields have the default text not just one. > In this case i prefer the approach of creating a "fake" field called > places, populated with the plac

Re: Model design

2009-10-24 Thread Vinicius Mendes | meiocodigo.com
On Oct 24, 7:14 am, Caisys wrote: > Thanks !!! I also felt the second sounds more "right" which leads to > two requirements, the first is for convenience but the second is a > must: > > 1) On the admin page for add Place I will put 2 or 3 slots for adding > Subplace to a place ... is there a wa

Re: Model design

2009-10-24 Thread Caisys
Thanks !!! I also felt the second sounds more "right" which leads to two requirements, the first is for convenience but the second is a must: 1) On the admin page for add Place I will put 2 or 3 slots for adding Subplace to a place ... is there a way where the first one would be filled with "defa

Re: Model design

2009-10-23 Thread Léon Dignòn
The second sounds more logically. On 23 Okt., 15:41, chefsmart wrote: > I would go with your second solution. > > On Oct 23, 5:17 pm, Caisys wrote: > > > > > Hi, > > I have classes for Event, Place and Subplace. Some of the Places are > > divided into different Halls (Subplace) and some have on

Re: Model design

2009-10-23 Thread chefsmart
I would go with your second solution. On Oct 23, 5:17 pm, Caisys wrote: > Hi, > I have classes for Event, Place and Subplace. Some of the Places are > divided into different Halls (Subplace) and some have only one. I > would like to know how design the relations between the classes. > > 1) Shoul

Re: model design issue

2009-03-26 Thread Oli Warner
The true relational way would be to have another Model called JobRunParameter with an FK on Parameter. It's getting a bit silly though and all these look-ups are going to be a pain later on. If Parameter is just a string key/value style thing, I might have simplified things a little and instead of

Re: Model design help

2007-07-28 Thread James Bennett
On 7/28/07, Cole Tuininga <[EMAIL PROTECTED]> wrote: > I could do something like a simple many to many relationship in the > attendee model, but that doesn't indicate ordering (most preferred to > least preferred) per timeslot. You might want to look at thisL http://www.djangoproject.com/documen

Re: Model design help

2007-07-28 Thread oggie rob
When you use a ManyToMany field, a "private" table (not tied to a model like other tables) is created in the database with something like the following (created via the contrib.auth.User's user_permissions field: id, user_id, permission_id If you wanted to create your own table that mirrors this

[resolved] Re: Model design problem ? (double ForeignKey)

2007-07-25 Thread Master.h2zu
On 25 juil, 14:49, Tim Chase <[EMAIL PROTECTED]> wrote: > When you add a foreign-key to your model, the referenced model > gets a psedudo-attribute, usually called _set which is > the set of s that have this attribute. By adding the > related_name, you provide a way to reference the Units for whi

Re: Model design problem ? (double ForeignKey)

2007-07-25 Thread Tim Chase
>>responsable = models.ForeignKey('Personne', ...) >> >> if you need to forward-reference a model that hasn't yet been >> defined. > > thanks for the anwser. > I dont saw this particular sentence. The magic is in the phrase "If you need to create a relationship on a model that has not yet b

Re: Model design problem ? (double ForeignKey)

2007-07-25 Thread Master.h2zu
> >responsable = models.ForeignKey('Personne', ...) > > if you need to forward-reference a model that hasn't yet been > defined. thanks for the anwser. I dont saw this particular sentence. But now I have this message: directory.unite: Reverse query name for field 'responsable' clashes with

Re: Model design problem ? (double ForeignKey)

2007-07-25 Thread Tim Chase
> I like to do something like that in a app models.py: > > > class Unite(models.Model): > responsable = models.ForeignKey(Personne, verbose_name='The > Chief', blank=True) > ... > > class Personne(models.Model): > unite = models.ForeignKey(Unite,null=True) > > > > And I h