I think you can use model.object.get_or_create()
and like this:
patient,err = Patient.obiect.get_or_create(kwgs)
if the object existed,the returned will be wrong, if not ,it will be
true,
and then you update this instence.
在 2018年5月29日星期二 UTC+8下午7:41:29,Albin Antony写道:
>
> Hello guys,
> Sor
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
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
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
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
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
Hello guys,
Sorry about the above no subject mail
I am getting a json string(json_string) from frontend. How can we update
the django database in views.py. Below is my models.py.
models.py
class Patient(models.Model):
patient_id = models.CharField(primary_key=True, max_length=200)
patient
7 matches
Mail list logo