Minor fixes needed for generic key name
We no longer try to retreive an entity when there are unset fields.
This sort of makes 'getIfFields' obsolete, since we check if fields
now anyway. This is needed because getKeyFieldsFromDict expects the
fields to be set.
Also a minor fix in a Django template so that the generic 'edit' page
has a working delete button again.
--- a/app/soc/templates/soc/models/edit.html Mon Nov 03 19:04:04 2008 +0000
+++ b/app/soc/templates/soc/models/edit.html Mon Nov 03 19:47:02 2008 +0000
@@ -49,7 +49,7 @@
</td>
{% if entity %}
<td>
- <input type="button" onclick="location.href='{{ entity_name_short }}/delete/{{ entity_suffix }}'" value="Delete"/>
+ <input type="button" onclick="location.href='/{{ entity_type_short|lower }}/delete/{{ entity_suffix }}'" value="Delete"/>
</td>
{% endif %}
{% endblock %}
--- a/app/soc/views/models/base.py Mon Nov 03 19:04:04 2008 +0000
+++ b/app/soc/views/models/base.py Mon Nov 03 19:47:02 2008 +0000
@@ -160,8 +160,9 @@
entity = None
try:
- key_fields = self._logic.getKeyFieldsFromDict(kwargs)
- entity = self._logic.getIfFields(key_fields)
+ if all(kwargs.values()):
+ key_fields = self._logic.getKeyFieldsFromDict(kwargs)
+ entity = self._logic.getIfFields(key_fields)
except soc.logic.out_of_band.ErrorResponse, error:
template = self._params['public_template']
error.message = error.message + self.DEF_CREATE_NEW_ENTITY_MSG % {