~harvest-dev/harvest/trunk

« back to all changes in this revision

Viewing changes to harvest/opportunities/views.py

  • Committer: Daniel Holbach
  • Date: 2010-06-03 11:16:57 UTC
  • mto: This revision was merged to the branch mainline in revision 186.
  • Revision ID: daniel.holbach@canonical.com-20100603111657-ixslf233u0ow73t0
extend action description to 200 chars, ellipsise action if necessary, log experience level changes too

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
1
2
from django.contrib.auth.decorators import login_required
2
3
from django.core.paginator import Paginator, InvalidPage, EmptyPage
3
4
from django.utils.translation import ugettext as _
55
56
        form = forms.OpportunityForm(data=request.POST, instance=opportunity)
56
57
        if form.is_valid():
57
58
            if form.cleaned_data["reviewed"] != opportunity.reviewed:
58
 
                models.log_action(request.user.username, action="marked as reviewed", 
 
59
                models.log_action(request.user, action="marked as reviewed", 
59
60
                                  opportunity=opportunity)
60
61
            if form.cleaned_data["applied"] != opportunity.applied:
61
 
                models.log_action(request.user.username, action="marked as applied", 
 
62
                models.log_action(request.user, action="marked as applied", 
 
63
                                  opportunity=opportunity)
 
64
            if form.cleaned_data["experience"] != opportunity.experience:
 
65
                models.log_action(request.user, 
 
66
                                  action="changed experience to: %s" % form.cleaned_data["experience"],
62
67
                                  opportunity=opportunity)
63
68
            if form.cleaned_data["comment"] != opportunity.comment:
64
 
                models.log_action(request.user.username, 
65
 
                                  action="changed comment to: '%s'" % \
66
 
                                    form.cleaned_data["comment"], 
 
69
                if len(form.cleaned_data["comment"]) > 178:
 
70
                    action = "changed comment to: '%s'" % (form.cleaned_data["comment"][:177]+u"…")
 
71
                else:
 
72
                    action = "changed comment to: '%s'" % form.cleaned_data["comment"]
 
73
                models.log_action(request.user, action=action,
67
74
                                  opportunity=opportunity)
68
75
            form.save()
69
76
            return HttpResponseRedirect(request.POST["next"])