Newbie : Help for using RequestContext

2018-01-09 Thread Mickael . barbo
Hello to all Django users :-) I'm new to Django and this is my first post. I'd like to implement breadcrumbs on all my pages. My strategy is to create a middleware and to use RequestContext to add a dict to the context of each request then use the context in my html My problem is that I don't u

Re: Newbie : Help for using RequestContext

2018-01-10 Thread mickael . barbo
Oh, *Thank you Andréas for your kind attention and your reactivity.* Nice, I didn't know about request.session... And thanks to you, *now I Know* :-) Just for archive, I found a way with context_processors here (old django version, but I adapt to django 2) : http://apprendre-python.com/page-dja

Newbie : Best data archive strategy

2018-06-12 Thread mickael . barbo
Hi, I'd like to archive some data. I came with this idea : class DataModel(models.Model): xxx class DataModelArchive(DataModel): pass The DataModelArchive database created has only "a pointer" to DataModel. I saw a post indicating that I'll have to first create an AbstractDataModel and inh

Re: Newbie : Best data archive strategy

2018-06-12 Thread mickael . barbo
Thanks Matthew for your response. I looked at Reversion. If I understand correctly what it did, it duplicate each transaction on internal database ? Le mardi 12 juin 2018 20:01:02 UTC+2, Matthew Pava a écrit : > > I think what you’re really looking for is an audit log. There are some > Django

Re: Newbie : Best data archive strategy

2018-06-12 Thread Mickael Barbo
Ok, so "audit log" is like a "snapshot". I think it's too much for what I need. To clarify my needs, I have a data that once "used/read", it's no more needed. I just want to keep it "archived", in an other place to get access to it if I want to add some function (statistics, etc...). So, Gerardo,

Newbie : Implementation possible ?

2018-06-26 Thread mickael . barbo
Hi community :) I'd like to implement something like "joined image". In Database, I'd like CoreObject to have the key of "Object1" OR "Object2" OR "Object3" (like foreignKey). How can I do that ? The context is that CoreObject is a central DataBaseFile and will receive information from one of

Newbie : Object copy - weird error :-)

2018-06-26 Thread mickael . barbo
Hi all :-) I'd like to archive some data. I did that : class AbstractDataModel(models.Model): xxx class Meta: abstract = True def __iter__(self): return iter([self.xxx, self.yyy, self.zzz, self.aaa, self.qqq, self.mode_bbb]) class DataModel(DataModel): pass c

Newbie : Object copy - weird error :-)

2018-06-26 Thread mickael . barbo
Hi all :-) I'd like to archive some data. I did that : class AbstractDataModel(models.Model): xxx class Meta: abstract = True def __iter__(self): return iter([self.xxx, self.yyy, self.zzz, self.aaa, self.qqq, self.mode_bbb]) class DataModel(AbstractDataModel):

Re: Newbie : Object copy - weird error :-)

2018-06-26 Thread mickael . barbo
Error typo, I creates a new thread with the good description ;-) Le mardi 26 juin 2018 16:35:27 UTC+2, Nelson Varela a écrit : > > The following class is kinda weird: > class DataModel(DataModel): > > A class which inherits itself??? > > > > On Tuesday, June 26, 2018 at 11:31:24 AM UTC+2, mickae..

Re: Newbie : Object copy - weird error :-)

2018-06-29 Thread Mickael Barbo
Hi 赖信桃, Sorry for formating problem. Here it is class AbstractDataModel(models.Model): xxx class Meta: abstract = True def __iter__(self): return iter([self.xxx, self.yyy, self.zzz, self.aaa, self.qqq, self.mode_bbb]) class DataModel(AbstractData

Re: Newbie : Object copy - weird error :-)

2018-06-29 Thread Mickael Barbo
Hello Julio, Ok, I see. I try to create a way to archive (copy) the same object instance on an other DataBase. I followed this advice : # https://stackoverflow.com/ questions/21699707/python-how-to-copy-all-attibutes-from- base-class-to-derived-one 2018-06-27 14:56 GMT+02:00 Julio Biason : >

Re: Newbie : Object copy - weird error :-)

2018-07-13 Thread mickael . barbo
Thanks you Melvyn, this is it :-) Have a nice day. Regards Le mardi 3 juillet 2018 00:34:14 UTC+2, Melvyn Sopacua a écrit : > > On vrijdag 29 juni 2018 09:44:40 CEST Mickael Barbo wrote: > > > > > I try to create a way to archive (copy) the same object instance on an

App structure : "One file - One object" - Is there a better way ?

2018-07-13 Thread Mickael Barbo
Hi ! *I like working with " 1 file - 1 object " (Object could be class, function...).* It simplify visibility, debug etc... and it's easy for me to *don't pollute my brain* :-) For exemple, I do : In *class_.py file* : class (): a b c from ._method1 import method1 from ._meth

Re: App structure : "One file - One object" - Is there a better way ?

2018-07-14 Thread Mickael Barbo
would you do that ?* For example, let's say you have a Customer class with 15 methods and the file is about 1000 lines of code. How to split this file in smaller files with 1 method per file ? Thanks for your help Anthony, hoping to be as clear as possible. Regards 2018-07-14 10:56 GMT+02