qualif: store keep formdata backoffice URL (#22550)
This commit is contained in:
parent
b231dee24a
commit
d2361b5e8a
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qualif', '0007_remove_association_triaged'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='association',
|
||||
name='formdata_url_backoffice',
|
||||
field=models.URLField(null=True),
|
||||
),
|
||||
]
|
|
@ -30,6 +30,7 @@ class Association(models.Model):
|
|||
comments = models.TextField(blank=True, verbose_name=_('Comments'))
|
||||
formdef_reference = models.CharField(max_length=250, null=True)
|
||||
formdata_id = models.CharField(max_length=250, null=True)
|
||||
formdata_url_backoffice = models.URLField(null=True)
|
||||
|
||||
def push(self, request):
|
||||
# push validated request to wcs
|
||||
|
@ -40,7 +41,7 @@ class Association(models.Model):
|
|||
reverse('wcs-summary', kwargs={'source_type': self.source_type_id,
|
||||
'source_pk': self.source_pk}))
|
||||
context.update(self.source.get_source_context(request))
|
||||
self.formdata_id = push_wcs_formdata(request, self.formdef_reference, context)
|
||||
self.formdata_id, self.formdata_url_backoffice = push_wcs_formdata(request, self.formdef_reference, context)
|
||||
self.save()
|
||||
|
||||
@property
|
||||
|
|
|
@ -142,7 +142,9 @@ def push_wcs_formdata(request, formdef_reference, context=None):
|
|||
headers={'Content-type': 'application/json'})
|
||||
if response.json().get('err') != 0:
|
||||
raise Exception('error %r' % response.content)
|
||||
return response.json()['data']['id']
|
||||
data = response.json()['data']
|
||||
return data['id'], data.get('backoffice_url')
|
||||
|
||||
|
||||
def get_wcs_data(endpoint, params=None):
|
||||
wcs_site = get_wcs_services().values()[0]
|
||||
|
|
Loading…
Reference in New Issue