0002-qualif-store-keep-formdata-backoffice-URL-22550.patch
welco/qualif/migrations/0008_association_formdata_url_backoffice.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
from __future__ import unicode_literals |
|
3 | ||
4 |
from django.db import migrations, models |
|
5 | ||
6 | ||
7 |
class Migration(migrations.Migration): |
|
8 | ||
9 |
dependencies = [ |
|
10 |
('qualif', '0007_remove_association_triaged'), |
|
11 |
] |
|
12 | ||
13 |
operations = [ |
|
14 |
migrations.AddField( |
|
15 |
model_name='association', |
|
16 |
name='formdata_url_backoffice', |
|
17 |
field=models.URLField(null=True), |
|
18 |
), |
|
19 |
] |
welco/qualif/models.py | ||
---|---|---|
30 | 30 |
comments = models.TextField(blank=True, verbose_name=_('Comments')) |
31 | 31 |
formdef_reference = models.CharField(max_length=250, null=True) |
32 | 32 |
formdata_id = models.CharField(max_length=250, null=True) |
33 |
formdata_url_backoffice = models.URLField(null=True) |
|
33 | 34 | |
34 | 35 |
def push(self, request): |
35 | 36 |
# push validated request to wcs |
... | ... | |
40 | 41 |
reverse('wcs-summary', kwargs={'source_type': self.source_type_id, |
41 | 42 |
'source_pk': self.source_pk})) |
42 | 43 |
context.update(self.source.get_source_context(request)) |
43 |
self.formdata_id = push_wcs_formdata(request, self.formdef_reference, context) |
|
44 |
self.formdata_id, self.formdata_url_backoffice = push_wcs_formdata(request, self.formdef_reference, context)
|
|
44 | 45 |
self.save() |
45 | 46 | |
46 | 47 |
@property |
welco/utils.py | ||
---|---|---|
139 | 139 |
headers={'Content-type': 'application/json'}) |
140 | 140 |
if response.json().get('err') != 0: |
141 | 141 |
raise Exception('error %r' % response.content) |
142 |
return response.json()['data']['id'] |
|
142 |
data = response.json()['data'] |
|
143 |
return data['id'], data.get('backoffice_url') |
|
144 | ||
143 | 145 | |
144 | 146 |
def get_wcs_data(endpoint, params=None): |
145 | 147 |
wcs_site = get_wcs_services().values()[0] |
146 |
- |