Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-14 Thread Peter of the Norse
> On Jun 10, 2015, at 10:33 AM, ThomasTheDjangoFan > wrote: > > Hi Bruno, > > Abstract Base Models come close but they don't allow me to combine multiple > instances of the BaseModel in the DataHolderModel. > > My goal is to store them all in one table without having to manually add all > t

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-11 Thread James Schneider
Are you trying to create something like a dynamic model, where the model attributes are named on the fly? Do you have one central model that needs to be able to have FK's to various other similar but distinct models? I think the better question is "what problem are you trying to solve?" > I just

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-10 Thread ThomasTheDjangoFan
Hi Felix, I just had a look at proxy models. Nice stuff, but it's not what I am looking for. I need to be able to give each "instance" an individual value. Hm Am Mittwoch, 10. Juni 2015 19:17:07 UTC+2 schrieb felix: > > El 10/06/15 12:33, ThomasTheDjangoFan escribió: > > Hi Bruno

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-10 Thread felix
El 10/06/15 12:33, ThomasTheDjangoFan escribió: Hi Bruno, Abstract Base Models come close but they don't allow me to combine multiple instances of the BaseModel in the DataHolderModel. My goal is to store them all in one table without having to manually add all the fields. Any suggestions?

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-10 Thread ThomasTheDjangoFan
Hi Bruno, Abstract Base Models come close but they don't allow me to combine multiple instances of the BaseModel in the DataHolderModel. My goal is to store them all in one table without having to manually add all the fields. Any suggestions? Am Mittwoch, 10. Juni 2015 17:49:13 UTC+2 schrieb

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-10 Thread Bruno A.
It looks like you want a Model to inherit from multiple base model? Multiple time from the same one, with different parameters? I'm not sure I understood what you are trying to do, but maybe abstract models can help you? https://docs.djangoproject.com/en/1.8/topics/db/models/#abstract-base-class

How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-09 Thread ThomasTheDjangoFan
Hi guys, now this is kind of hard for me to explain, I hope that somebody understands what I actually want. I am a python newbie and wonder if there is an easy solution. *They say: DRY!!* *My question is:How do a define an (abstract?) class including methods and fieldsand then attach it to