Commits

John Costa committed 125d066

split into submitted and not submitted

  • Participants
  • Parent commits d2a9f74

Comments (0)

Files changed (4)

File feature_request/models.py

 class FeatureRequestManager(models.Manager):
 
     #---------------------------------------------------------------------------
+    def get_my_submitted_features(self, user):
+        return self.get_my_features(user).filter(status=SUBMITTED)
+
+    #---------------------------------------------------------------------------
+    def get_my_unsubmitted_features(self, user):
+        return self.get_my_features(user).filter(status=EDITING)
+
+    #---------------------------------------------------------------------------
     def get_my_features(self, user):
-        return self.filter(active=True).order_by("is_complete")
+        return self.filter(active=True, member=user).order_by("is_complete")
 
     #---------------------------------------------------------------------------
     def get_features(self):

File feature_request/templates/feature_request/tags/list_submitted_user_requests.html

+<table border='1'>
+    <caption>My Submitted Requests</caption>
+    <thead>
+        <tr>
+            <th>Date Requested</th>
+            <th>Member</th>
+            <th>Requested Feature</th>
+            <th>Status</th>
+            <th>Score</th>
+            <th>Vote</th>
+            <th>Action</th>
+        </tr>
+    </thead>
+    <tbody>
+    {% for feature in user_requests %}
+        <tr>
+            <td>{{feature.create_date|date:"M dS Y"}}</td><td>{{feature.member}}</td><td>{{feature.request_title|linebreaksbr}}</td>
+            <td>{% if feature.is_complete %}Complete
+                    {% if feature.complete_date %}({{feature.complete_date}}){% endif %}
+                    {% if feature.complete_comments %}<br />{{feature.complete_comments|linebreaksbr}}{% endif %}
+                {% else %}
+                    {{  feature.status }}
+                {% endif %}
+            </td>
+            <td>{{ feature.score }}</td>
+            <td>
+                <form action="{% url feature_request_vote feature.id "up" %}" method="post">{% csrf_token %}<input type="submit" value="+" /></form>
+                <form action="{% url feature_request_vote feature.id "down" %}" method="post">{% csrf_token %}<input type="submit" value="-" /></form>
+                <form action="{% url feature_request_vote feature.id "clear" %}" method="post">{% csrf_token %}<input type="submit" value="clear" /></form>
+            </td>
+            <td>
+                {% if feature.is_editable %}
+                    <a href="{% url feature_request_delete feature.id %}">Delete</a>&nbsp;
+                    <a href="{% url feature_request_edit feature.id %}" >Edit</a>&nbsp;
+                    <a href="{% url feature_request_submit feature.id %}" >Submit</a>
+                {% endif %}
+            </td>
+        </tr>
+    {% endfor %}
+    </tbody>
+</table>

File feature_request/templates/feature_request/tags/list_unsubmitted_user_requests.html

+<table border='1'>
+    <caption>My Unsubmitted Requests</caption>
+    <thead>
+        <tr>
+            <th>Date Requested</th>
+            <th>Member</th>
+            <th>Requested Feature</th>
+            <th>Status</th>
+            <th>Score</th>
+            <th>Vote</th>
+            <th>Action</th>
+        </tr>
+    </thead>
+    <tbody>
+    {% for feature in user_requests %}
+        <tr>
+            <td>{{feature.create_date|date:"M dS Y"}}</td><td>{{feature.member}}</td><td>{{feature.request_title|linebreaksbr}}</td>
+            <td>{% if feature.is_complete %}Complete
+                    {% if feature.complete_date %}({{feature.complete_date}}){% endif %}
+                    {% if feature.complete_comments %}<br />{{feature.complete_comments|linebreaksbr}}{% endif %}
+                {% else %}
+                    {{  feature.status }}
+                {% endif %}
+            </td>
+            <td>{{ feature.score }}</td>
+            <td>
+                <form action="{% url feature_request_vote feature.id "up" %}" method="post">{% csrf_token %}<input type="submit" value="+" /></form>
+                <form action="{% url feature_request_vote feature.id "down" %}" method="post">{% csrf_token %}<input type="submit" value="-" /></form>
+                <form action="{% url feature_request_vote feature.id "clear" %}" method="post">{% csrf_token %}<input type="submit" value="clear" /></form>
+            </td>
+            <td>
+                {% if feature.is_editable %}
+                    <a href="{% url feature_request_delete feature.id %}">Delete</a>&nbsp;
+                    <a href="{% url feature_request_edit feature.id %}" >Edit</a>&nbsp;
+                    <a href="{% url feature_request_submit feature.id %}" >Submit</a>
+                {% endif %}
+            </td>
+        </tr>
+    {% endfor %}
+    </tbody>
+</table>

File feature_request/templatetags/feature_request_tags.py

 @register.inclusion_tag('feature_request/tags/list_user_requests.html')
 def list_user_requests(user):
     user_requests = FeatureRequest.objects.get_my_features(user)
+    return { 'user_requests' : user_requests, }
+
+@register.inclusion_tag('feature_request/tags/list_unsubmitted_user_requests.html')
+def list_unsubmitted_user_requests(user):
+    user_requests = FeatureRequest.objects.get_my_unsubmitted_features(user)
+    return { 'user_requests' : user_requests, }
+
+@register.inclusion_tag('feature_request/tags/list_submitted_user_requests.html')
+def list_submitted_user_requests(user):
+    user_requests = FeatureRequest.objects.get_my_submitted_features(user)
     return { 'user_requests' : user_requests, }