0001-wcs-add-support-for-qualifying-assets-with-an-option.patch
combo/apps/wcs/models.py | ||
---|---|---|
104 | 104 |
def get_asset_slots(self): |
105 | 105 |
slots = {} |
106 | 106 |
for slot_template_key, slot_template_data in settings.WCS_FORM_ASSET_SLOTS.items(): |
107 |
suffix = '' |
|
108 |
if slot_template_data.get('suffix'): |
|
109 |
suffix = ' (%s)' % slot_template_data['suffix'] |
|
107 | 110 |
slots['wcs:form:%s:%s' % (slot_template_key, self.formdef_reference)] = { |
108 |
'label': u'%(prefix)s — %(label)s' % { |
|
111 |
'label': u'%(prefix)s — %(label)s%(suffix)s' % {
|
|
109 | 112 |
'prefix': slot_template_data['prefix'], |
110 |
'label': self.cached_title}} |
|
113 |
'label': self.cached_title, |
|
114 |
'suffix': suffix}} |
|
111 | 115 |
return slots |
112 | 116 | |
113 | 117 | |
... | ... | |
143 | 147 |
def get_asset_slots(self): |
144 | 148 |
slots = {} |
145 | 149 |
for slot_template_key, slot_template_data in settings.WCS_CATEGORY_ASSET_SLOTS.items(): |
150 |
suffix = '' |
|
151 |
if slot_template_data.get('suffix'): |
|
152 |
suffix = ' (%s)' % slot_template_data['suffix'] |
|
146 | 153 |
slots['wcs:category:%s:%s' % (slot_template_key, self.category_reference)] = { |
147 |
'label': u'%(prefix)s — %(label)s' % { |
|
154 |
'label': u'%(prefix)s — %(label)s%(suffix)s' % {
|
|
148 | 155 |
'prefix': slot_template_data['prefix'], |
149 |
'label': self.cached_title}} |
|
156 |
'label': self.cached_title, |
|
157 |
'suffix': suffix}} |
|
150 | 158 |
return slots |
151 | 159 | |
152 | 160 |
tests/test_wcs.py | ||
---|---|---|
651 | 651 |
assert u'>Logo — Test 9<' in resp.text |
652 | 652 |
assert u'>Picture — form title<' in resp.text |
653 | 653 | |
654 |
with override_settings( |
|
655 |
WCS_CATEGORY_ASSET_SLOTS={'logo': {'prefix': 'Logo', 'suffix': 'test'}}, |
|
656 |
WCS_FORM_ASSET_SLOTS={'picture': {'prefix': 'Picture', 'suffix': 'test'}}): |
|
657 |
resp = app.get('/manage/assets/') |
|
658 |
assert u'>Logo — Test 9 (test)<' in resp.text |
|
659 |
assert u'>Picture — form title (test)<' in resp.text |
|
660 | ||
654 | 661 |
@wcsctl_present |
655 | 662 |
def test_tracking_code_search(app): |
656 | 663 |
assert len(app.get('/api/search/tracking-code/').json.get('data')) == 0 |
657 |
- |