← Back to team overview

harvest-dev team mailing list archive

[Merge] lp:~dholbach/harvest/530098 into lp:harvest

 

Daniel Holbach has proposed merging lp:~dholbach/harvest/530098 into lp:harvest.

Requested reviews:
  harvest-dev (harvest-dev)
Related bugs:
  #530098 get featured opportunity lists on the mainpage
  https://bugs.launchpad.net/bugs/530098


It's not pretty and I have a hard time linking to the opportunity list without hard-coding. Dylan, can you help? :-D
-- 
https://code.launchpad.net/~dholbach/harvest/530098/+merge/33799
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/530098 into lp:harvest.
=== modified file 'harvest/common/views.py'
--- harvest/common/views.py	2010-08-23 16:44:10 +0000
+++ harvest/common/views.py	2010-08-26 16:17:43 +0000
@@ -4,9 +4,8 @@
 from django.contrib.auth import logout
 from django.contrib.auth.models import User
 
-from opportunities.models import SourcePackage, OpportunityList, Opportunity, Note
-
 def index(request):
+    from opportunities.models import SourcePackage, OpportunityList, Opportunity, Note
     context = { 
         'pageSection': 'home', 
         'users': User.objects.count(),
@@ -14,6 +13,7 @@
         'opportunitylists': OpportunityList.objects.count(),
         'opportunities': Opportunity.objects.count(),
         'notes': Note.objects.count(),
+        'features': OpportunityList.objects.filter(featured=True),
     }
     return render_to_response('index.html', context,
                               context_instance=RequestContext(request))

=== modified file 'harvest/templates/index.html'
--- harvest/templates/index.html	2010-08-23 16:44:10 +0000
+++ harvest/templates/index.html	2010-08-26 16:17:43 +0000
@@ -40,5 +40,28 @@
 {% blocktrans count opportunitylists as counter %}1 opportunity list, {% plural %}{{ counter }} opportunity lists, {% endblocktrans %} 
 {% blocktrans count notes as counter %}1 note.{% plural %}{{ counter }} notes.{% endblocktrans %}
 </div>
+{% if features %}
+  <div id="featured">
+    <h2>{% trans "Featured Opportunities" %}</h2>
+    <ul>
+    {% for feature in features %}
+      <li>
+        <h3>
+          {{ feature.name }}
+          ({{feature.opportunity_set.all|length}} {% trans "opportunities"%})
+        </h3>
+        <ul>
+        {% for opportunity in feature.opportunity_set.all|slice:":5" %}
+          <li>
+            <a href="{% url opportunity_edit opportunity.id %}">{{opportunity.description}}</a>
+            ({{opportunity.sourcepackage}})
+          </li>
+        {% endfor %}
+        </ul>
+      </li>
+    {% endfor %}
+    </ul>
+  </div>
+{% endif %}
 </div>
 {% endblock %}


Follow ups