mango r269 - in branches/django: . mango www



Author: ovitters
Date: Fri Jun 27 21:30:57 2008
New Revision: 269
URL: http://svn.gnome.org/viewvc/mango?rev=269&view=rev

Log:
	* mango/views.py (list_accounts): Allow filtering of accounts on
	status and on cn/name/uid.
	* www/list_accounts.xsl: Make sure the chosen status is selected
	again.


Modified:
   branches/django/   (props changed)
   branches/django/ChangeLog
   branches/django/mango/views.py
   branches/django/www/list_accounts.xsl

Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py	(original)
+++ branches/django/mango/views.py	Fri Jun 27 21:30:57 2008
@@ -172,7 +172,15 @@
 def list_accounts(request):
     doc, pagenode = get_xmldoc('List Accounts', request, 'listaccounts')
 
-    queryset = models.AccountRequest.objects.filter(status='S')
+    filter = setup_filter(pagenode, request.GET, {
+        'keyword': lambda keyword: Q(uid__contains=keyword) | Q(cn__contains=keyword) | Q(mail__contains=keyword),
+        'status': lambda keyword: Q(status=keyword)
+    })
+    if filter:
+        queryset = models.AccountRequest.objects.filter(filter)
+    else:
+        queryset = models.AccountRequest.objects.filter(status='S')
+
 
     page = setup_xml_paginator(request, pagenode, queryset)
     for obj in page.object_list:

Modified: branches/django/www/list_accounts.xsl
==============================================================================
--- branches/django/www/list_accounts.xsl	(original)
+++ branches/django/www/list_accounts.xsl	Fri Jun 27 21:30:57 2008
@@ -7,7 +7,7 @@
 
   <xsl:include href="common.xsl" />
 
-  <xsl:variable name="script" select="'list_accounts.php'"/>
+  <xsl:variable name="script" select="'.'"/>
  
   <xsl:template match="listaccounts">
    <xsl:apply-templates select="error"/>
@@ -23,11 +23,16 @@
         <input type="submit" value="&gt; &gt;"/>
        </noscript>
        <select name="filter_status">
-	 <option value="S">Awaiting setup</option>
-	 <option value="V">Awaiting vouchers</option>
-	 <option value="M">Awaiting mail verification</option>
-	 <option value="A">Created</option>
-	 <option value="R">Rejected</option>
+	 <option value="S"><xsl:if test="filter/status = 'S'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
+	   Awaiting setup</option>
+	 <option value="V"><xsl:if test="filter/status = 'V'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
+	   Awaiting vouchers</option>
+	 <option value="M"><xsl:if test="filter/status = 'M'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
+	   Awaiting mail verification</option>
+	 <option value="A"><xsl:if test="filter/status = 'A'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
+	   Created</option>
+	 <option value="R"><xsl:if test="filter/status = 'R'"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
+	   Rejected</option>
        </select>
       </td>
       <td align="right">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]