# HG changeset patch # User Sverre Rabbelier # Date 1227400715 0 # Node ID ba4a7e90139d30a3f6fa2545fef61771819e5fd3 # Parent b7b77b4c96129208f794a362e8e112cb165af046 Fix Host invites This fixes the UI for Host invites by hiding the fields that are not used, and by auto-filling in the user and scope fields based on link_id and scope_path. diff -r b7b77b4c9612 -r ba4a7e90139d app/soc/models/host.py --- a/app/soc/models/host.py Sat Nov 22 23:34:06 2008 +0000 +++ b/app/soc/models/host.py Sun Nov 23 00:38:35 2008 +0000 @@ -32,8 +32,4 @@ """Host details for a specific Program. """ - #: A 1:1 relationship associating a Host with specific - #: Sponsor details and capabilities. The back-reference in - #: the Sponsor model is a Query named 'host'. - sponsor = db.ReferenceProperty(reference_class=soc.models.sponsor.Sponsor, - required=True, collection_name='hosts') + pass diff -r b7b77b4c9612 -r ba4a7e90139d app/soc/templates/soc/host/list/row.html --- a/app/soc/templates/soc/host/list/row.html Sat Nov 22 23:34:06 2008 +0000 +++ b/app/soc/templates/soc/host/list/row.html Sun Nov 23 00:38:35 2008 +0000 @@ -1,7 +1,7 @@ diff -r b7b77b4c9612 -r ba4a7e90139d app/soc/views/models/host.py --- a/app/soc/views/models/host.py Sat Nov 22 23:34:06 2008 +0000 +++ b/app/soc/views/models/host.py Sun Nov 23 00:38:35 2008 +0000 @@ -22,9 +22,12 @@ ] +from django import forms from django.utils.translation import ugettext_lazy from soc.logic import dicts +from soc.logic.models import user as user_logic +from soc.logic.models import sponsor as sponsor_logic from soc.views import helper from soc.views.models import base from soc.views.models import role @@ -47,7 +50,7 @@ model = soc.models.host.Host #: list of model fields which will *not* be gathered by the form - exclude = ['scope'] + exclude = ['scope', 'user'] def clean_empty(self, field): data = self.cleaned_data.get(field) @@ -105,6 +108,22 @@ role.RoleView.__init__(self, original_params=params) + def _editSeed(self, request, seed): + """See base.View._editGet(). + """ + + def _editPost(self, request, entity, fields): + """See base.View._editPost(). + """ + + user = user_logic.logic.getForFields( + {'link_id': fields['link_id']}, unique=True) + fields['user'] = user + + sponsor = sponsor_logic.logic.getForFields( + {'link_id': fields['scope_path']}, unique=True) + fields['scope'] = sponsor + view = View()