Re: Updating django database

2018-06-02 Thread 'Anthony Flury' via Django users
Is this a new or a update from the front end ? If new : 1 Extract json using : data = json.load( request.POST['json'] - this converts data to a dictionary (assuming that the json is in the 'json' field in the message. 2 Validate as necessary 3 Create instance : instance = Patien

Re: Updating django database

2018-06-02 Thread Albin Antony
For updating multiple models at the same time, Should we create multiple instances? On Sat, Jun 2, 2018 at 6:19 PM, 'Anthony Flury' via Django users < django-users@googlegroups.com> wrote: > Is this a new or a update from the front end ? > > If new : > 1 Extract json using : data = json.load

Re: Updating django database

2018-06-02 Thread Melvyn Sopacua
On zaterdag 2 juni 2018 15:12:08 CEST Albin Antony wrote: > For updating multiple models at the same time, Should we create multiple > instances? Multiple models (Patient and Medication) or multiple instances of the same model (more than one Patient)? The later can be done with a single manager

Re: Updating django database

2018-06-02 Thread Albin Antony
Can the first be done if there is a relation between the models? On Sat, Jun 2, 2018 at 7:49 PM, Melvyn Sopacua wrote: > On zaterdag 2 juni 2018 15:12:08 CEST Albin Antony wrote: > > For updating multiple models at the same time, Should we create multiple > > instances? > > Multiple models (Pat

Re: Updating django database

2018-06-02 Thread 'Anthony Flury' via Django users
Is this a new or a update from the front end ? If new : 1 Extract json using : data = json.load( request.POST['json'] - this converts data to a dictionary (assuming that the json is in the 'json' field in the message. 2 Validate as necessary 3 Create instance : instance = Patien

Is it possible to instantiate a model (create an object) and flag the instance as unsaveable?

2018-06-02 Thread Bernd Wechner
I'd like to instantiate a model, and play around with it, but ensure it's never saved. At bare minimum instantiate it, play around with it then delete it, but ideally disable saving somehow. I imagine I can override save() on the instance, but am wondering if anyone has experience doing this or

Re: Is it possible to instantiate a model (create an object) and flag the instance as unsaveable?

2018-06-02 Thread James Bradshaw
Hey Bernd, I'm curious about your use case. It's common to create a read-only database user to make sure no data is modified, but I've never come across anything at the instance/row level. -Jimmy On Sat, Jun 2, 2018, 8:14 PM Bernd Wechner wrote: > I'd like to instantiate a model, and play arou

Re: Is it possible to instantiate a model (create an object) and flag the instance as unsaveable?

2018-06-02 Thread James Schneider
On Sat, Jun 2, 2018, 6:14 PM Bernd Wechner wrote: > I'd like to instantiate a model, and play around with it, but ensure it's > never saved. At bare minimum instantiate it, play around with it then > delete it, but ideally disable saving somehow. I imagine I can override > save() on the instance,