X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Futils.py;h=05e66e26eb0c72bd9b7e0db0378fc9e5d012a1cb;hb=07ded8bef209073969ca66049c91783ce59fc0f7;hp=72eff4f764d81f88d9c2f4be239245b2cdc60c7b;hpb=3c6909740c2b00c31a9b39b5ef8e0ce7f588f685;p=patchwork diff --git a/apps/patchwork/utils.py b/apps/patchwork/utils.py index 72eff4f..05e66e2 100644 --- a/apps/patchwork/utils.py +++ b/apps/patchwork/utils.py @@ -19,7 +19,7 @@ from patchwork.forms import MultiplePatchForm -from patchwork.models import Bundle, Project, State +from patchwork.models import Bundle, Project, State, UserProfile from django.conf import settings from django.shortcuts import render_to_response, get_object_or_404 @@ -40,10 +40,11 @@ def get_patch_ids(d, prefix = 'patch_id'): class Order(object): order_map = { - 'date': 'date', - 'name': 'name', - 'state': 'state__ordering', - 'submitter': 'submitter__name' + 'date': 'date', + 'name': 'name', + 'state': 'state__ordering', + 'submitter': 'submitter__name', + 'delegate': 'delegate__username', } default_order = 'date' @@ -88,7 +89,7 @@ class Order(object): return q bundle_actions = ['create', 'add', 'remove'] -def set_bundle(user, action, data, patches, context): +def set_bundle(user, project, action, data, patches, context): # set up the bundle bundle = None if action == 'create': @@ -142,12 +143,10 @@ def set_patches(user, project, action, data, patches, context): str = '' - print "action: ", action - # this may be a bundle action, which doesn't modify a patch. in this # case, don't require a valid form, or patch editing permissions if action in bundle_actions: - errors = set_bundle(user, action, data, patches, context) + errors = set_bundle(user, project, action, data, patches, context) return (errors, form) if not form.is_valid(): @@ -191,3 +190,8 @@ def set_patches(user, project, action, data, patches, context): context.add_message(str) return (errors, form) + +def userprofile_register_callback(user): + profile = UserProfile(user = user) + profile.save() +