Make reference picker work for create too
Caveat, it only works for one reference atm.
Patch by: Sverre Rabbelier
--- a/app/soc/views/models/base.py Fri Jan 23 22:20:20 2009 +0000
+++ b/app/soc/views/models/base.py Fri Jan 23 22:57:10 2009 +0000
@@ -388,8 +388,10 @@
self._editGet(request, entity, form)
else:
+ seed = seed if seed else {}
+ self._editSeed(request, seed)
+
if seed:
- self._editSeed(request, seed)
form = params['create_form'](initial=seed)
else:
form = params['create_form']()
@@ -641,7 +643,11 @@
seed: the fields to seed the create page with
"""
- pass
+ field = request.GET.get('field', None)
+ value = request.GET.get('value', None)
+
+ if field and value:
+ seed[field] = value
def _constructResponse(self, request, entity, context, form, params):
"""Updates the context and returns a response for the specified arguments.
--- a/app/soc/views/models/club_app.py Fri Jan 23 22:20:20 2009 +0000
+++ b/app/soc/views/models/club_app.py Fri Jan 23 22:57:10 2009 +0000
@@ -203,6 +203,8 @@
form.fields['backup_admin_link_id'].initial = entity.backup_admin.link_id
+ super(View, self)._editGet(request, entity, form)
+
def _editPost(self, request, entity, fields):
"""See base.View._editPost().
"""