django - Pop up message when there are no records -


template

{% item in category %}    <tr>        <td>{{ item.invoice_no }}</td>        <td>{{item.invoice_date_of_issue}}</td>        <td>{{ item.po_no }}</td>        <td>{{ item.estimate_no}}</td>        <td>{{ item.customer_id}}</td>        <td>{{ item.subject_id}}</td>            <td>{{ item.discount}}</td>        <td>{{ item.status }}</td>        <td><a name="del" href='/invoiceupdate/{{item.invoice_no}}/'>update</a></td>       <td><a class="delete" data-confirm="are sure delete item?" href='/invoicedelete/{{item.invoice_no}}/'><img src="http://icons.iconseeker.com/png/fullsize/aspnet/trash-delete.png"></a></td>      </tr>    {% endfor %} 

view.py

def invoice_date(request):     id = invoice.objects.all().values_list('customer_id', flat=true)            note=request.post.get("fromdate")     note1=request.post.get("todate")     if request.method=="get":         form=invoiceform     else:         category=invoice.objects.filter(invoice_date_of_issue__range=[note,note1])         return render_to_response('test.html',locals(),context_instance=requestcontext(request))      return render_to_response('test.html',locals(),context_instance=requestcontext(request)) 

i want display pop message when there no records in invoice within selected date range.

can please me out in doing this??thanks in advance

if filtering object according date in view, can in template:

{% if category %}      dor {%else%}     call javascript or show message {%endif%} 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -