Merge lp:~dholbach/harvest/581724 into lp:harvest

Proposed by Daniel Holbach
Status: Merged
Merged at revision: 185
Proposed branch: lp:~dholbach/harvest/581724
Merge into: lp:harvest
Diff against target: 146 lines (+10/-22)
7 files modified
harvest/opportunities/models.py (+0/-12)
harvest/opportunities/templates/opportunities/opportunities_by_package.html (+1/-1)
harvest/opportunities/views.py (+3/-3)
harvest/templates/opportunities/opportunity_detail.inc.html (+3/-3)
harvest/templates/opportunities/opportunity_index.html (+1/-1)
harvest/templates/opportunities/opportunitylist_list.html (+1/-1)
harvest/templates/opportunities/sourcepackage_list.html (+1/-1)
To merge this branch: bzr merge lp:~dholbach/harvest/581724
Reviewer Review Type Date Requested Status
Daniel Holbach Pending
James Westby Pending
harvest-dev Pending
Review via email: mp+27599@code.launchpad.net

This proposal supersedes a proposal from 2010-06-08.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote : Posted in a previous version of this proposal

Looks good to me.

Do django templates automatically call methods in {{{}}} blocks?

Thanks,

James

review: Approve
Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

Dylan just asked me to use the {%url <...> %} templatetag instead, so I'll have a look into using that instead.

Thanks a bunch for the review!

review: Needs Fixing
Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

This is weird, my fresh checkout of the branch does not contain any "+<<<<<<< TREE".

Revision history for this message
Dylan McCall (dylanmccall) wrote : Posted in a previous version of this proposal

Try rebasing it. Maybe it's Launchpad being funny about potential merge conflicts :)

Thanks for doing that with the url templatetag. It helps to separate the front end from the rest, which should serve us well in the future :)
It looks right to me!

I am not a huge fan of line 124:

  (<a href="{% url opportunity_detail opportunity.id %}edit?next={{request.get_full_path}}">edit</a>)

The hard-coded “edit” added to the end is asking for trouble. Would be nice to have a separate opportunity_edit URL. I think there is a templatetag somewhere to append GET parameters a bit more elegantly, too, although that isn't so much of an issue…

The same was there before, though, so we can just put it on the list of little things that don't really _need_ to be fixed, but would be satisfying to do :)

Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

Ok, so I fixed the URL, but it doesn't get better than this:

    {% url opportunity_edit opportunity.id %}/?next={{request.get_full_path}}

We need 'next' as an argument as part of the URL for some reason I forgot, but at least I'm not munging the opportunity_edit URL together now, but use the real one. :-)

If somebody has an idea how to make this even better, please let me know. :)

Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

Can this be landed? :)

Revision history for this message
James Westby (james-w) wrote : Posted in a previous version of this proposal

8 - def __unicode__(self):
9 - return self.name

Did you mean to delete that?

Otherwise this looks good to me.

Thanks,

James

review: Approve
Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks for the review James - I re-added the __unicode__ function - that was slightly muppet-esque and I fixed it. :-)

I just saw that you approved the last proposal, so I'll go ahead and merge it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'harvest/opportunities/models.py'
2--- harvest/opportunities/models.py 2010-06-04 14:55:30 +0000
3+++ harvest/opportunities/models.py 2010-06-15 08:49:24 +0000
4@@ -20,10 +20,6 @@
5 def __unicode__(self):
6 return self.name
7
8- @models.permalink
9- def get_absolute_url(self):
10- return ('packagesets', [self.name])
11-
12
13 class SourcePackage(models.Model):
14 name = models.SlugField(_("Name"), max_length=70)
15@@ -35,10 +31,6 @@
16 def __unicode__(self):
17 return self.name
18
19- @models.permalink
20- def get_absolute_url(self):
21- return ('sourcepackage_detail', [self.name])
22-
23 @property
24 def valid_opportunities(self):
25 return self.opportunity_set.filter(valid=True)
26@@ -73,10 +65,6 @@
27 def __unicode__(self):
28 return self.name
29
30- @models.permalink
31- def get_absolute_url(self):
32- return ('opportunitylist_detail', [self.name])
33-
34 @property
35 def opportunity_urgency(self):
36 if self.featured:
37
38=== modified file 'harvest/opportunities/templates/opportunities/opportunities_by_package.html'
39--- harvest/opportunities/templates/opportunities/opportunities_by_package.html 2010-02-22 15:43:51 +0000
40+++ harvest/opportunities/templates/opportunities/opportunities_by_package.html 2010-06-15 08:49:24 +0000
41@@ -13,7 +13,7 @@
42 {% for source in sources.object_list %}
43 <li>
44 <div class="package_name threshold{{ source.opportunity_class }}">
45- <span class="name">{{ source.name }}</span>
46+ <span class="name"><a href="{% url sourcepackage_detail source.name %}">{{ source.name }}</a></span>
47 <span class="count">
48 ({{ source.valid_opportunities.count }} issues)
49 </span>
50
51=== modified file 'harvest/opportunities/views.py'
52--- harvest/opportunities/views.py 2010-06-03 11:16:57 +0000
53+++ harvest/opportunities/views.py 2010-06-15 08:49:24 +0000
54@@ -36,7 +36,7 @@
55 def opportunity_list(request):
56 return list_detail.object_list(
57 request,
58- queryset = models.Opportunity.objects.all(),
59+ queryset = models.Opportunity.objects.filter(last_updated=opportunitylist__last_updated),
60 paginate_by = 500,
61 template_object_name = 'opportunity',
62 )
63@@ -44,7 +44,7 @@
64 def opportunity_detail(request, opportunity_id):
65 return list_detail.object_detail(
66 request,
67- queryset = models.Opportunity.objects.all(),
68+ queryset = models.Opportunity.objects.filter(last_updated=opportunitylist__last_updated),
69 object_id = opportunity_id,
70 template_object_name = 'opportunity',
71 )
72@@ -121,7 +121,7 @@
73 )
74
75 def opportunities_by_type(request):
76- types_list = models.OpportunityList.objects.all()
77+ types_list = models.OpportunityList.objects.filter(active=True)
78 paginator = Paginator(types_list, 50)
79
80 # Make sure page request is an int. If not, deliver first page.
81
82=== modified file 'harvest/templates/opportunities/opportunity_detail.inc.html'
83--- harvest/templates/opportunities/opportunity_detail.inc.html 2010-03-08 16:43:38 +0000
84+++ harvest/templates/opportunities/opportunity_detail.inc.html 2010-06-15 08:49:24 +0000
85@@ -3,19 +3,19 @@
86 <a href="{{opportunity.url}}">{{ opportunity.description }}</a>
87 {% if grouping %}
88 {% ifequal grouping "type" %}
89- ({{ opportunity.sourcepackage }})
90+ <a href="{% url sourcepackage_detail opportunity.sourcepackage.name %}">({{ opportunity.sourcepackage }})</a>
91 {% endifequal %}
92 {% ifequal grouping "package" %}
93 ({{ opportunity.opportunitylist }})
94 {% endifequal %}
95 {% else %}
96- ({{ opportunity.sourcepackage }} - {{ opportunity.opportunitylist }})
97+ (<a href="{% url sourcepackage_detail opportunity.sourcepackage.name %}">({{ opportunity.sourcepackage }})</a> - {{ opportunity.opportunitylist }})
98 {% endif %}
99 {% if opportunity.experience %}
100 <span class="experience{{ opportunity.experience }}"></span>
101 {% endif %}
102 {% if user.is_authenticated %}
103- (<a href="{{opportunity.get_absolute_url}}edit?next={{request.get_full_path}}">edit</a>)
104+ (<a href="{% url opportunity_edit opportunity.id %}?next={{request.get_full_path}}">edit</a>)
105 {% endif %}
106 </span>
107 </li>
108
109=== modified file 'harvest/templates/opportunities/opportunity_index.html'
110--- harvest/templates/opportunities/opportunity_index.html 2010-02-22 15:43:51 +0000
111+++ harvest/templates/opportunities/opportunity_index.html 2010-06-15 08:49:24 +0000
112@@ -11,7 +11,7 @@
113 {% if sources.object_list %}
114 <ul>
115 {% for source in sources.object_list %}
116-<li>{{ source.name }}
117+<li><a href="{% url sourcepackage_detail source.name %}">{{ source.name }}</a>
118 <ul>
119 {% for opportunity in source.valid_opportunites %}
120 {% include "opportunities/opportunity_detail.inc.html" %}
121
122=== modified file 'harvest/templates/opportunities/opportunitylist_list.html'
123--- harvest/templates/opportunities/opportunitylist_list.html 2009-09-13 16:53:16 +0000
124+++ harvest/templates/opportunities/opportunitylist_list.html 2010-06-15 08:49:24 +0000
125@@ -7,7 +7,7 @@
126 {% block content %}
127 <h2>Opportunity Lists</h2>
128 {% for opportunity_list in object_list %}
129- <h3><a href="{{ opportunity_list.get_absolute_url }}">{{ opportunity_list.name }}</a> ({{ opportunity_list.opportunity__count }} issue{{ opportunity_list.opportunity__count|pluralize }})</h3>
130+ <h3><a href="{% url opportunitylist_detail opportunity_list %}">{{ opportunity_list.name }}</a> ({{ opportunity_list.opportunity__count }} issue{{ opportunity_list.opportunity__count|pluralize }})</h3>
131 <p>{{ opportunity_list.description }}</p>
132 {% endfor %}
133 {% endblock %}
134
135=== modified file 'harvest/templates/opportunities/sourcepackage_list.html'
136--- harvest/templates/opportunities/sourcepackage_list.html 2009-09-13 16:53:16 +0000
137+++ harvest/templates/opportunities/sourcepackage_list.html 2010-06-15 08:49:24 +0000
138@@ -8,7 +8,7 @@
139 <h2>Source Packages</h2>
140 <ul>
141 {% for source_package in object_list %}
142- <li><a href="{{ source_package.get_absolute_url }}">{{ source_package.name }}</a> {{ source_package.opportunity__count }} issue{{ source_package.opportunity__count|pluralize }}</li>
143+ <li><a href="{% url sourcepackage_detail source_package %}">{{ source_package.name }}</a> {{ source_package.opportunity__count }} issue{{ source_package.opportunity__count|pluralize }}</li>
144 {% endfor %}
145 </ul>
146 {% endblock %}

Subscribers

People subscribed via source and target branches

to all changes: