Hi Alan,

How did you receive that `object_list`?
You should filter it based on you user and ‘Running’ inside the view. And then 
just check if it has count > 0.

I hope that does have sense to you.

Regards,
Constantine C.

> On Feb 22, 2018, at 7:34 PM, Alan <alanwil...@gmail.com> wrote:
> 
> Hi there,
> 
> I am using Django 2 with Python 3.5
> 
> I have this query, simple, in mysql:
> 
> select * from submit_submission where jstatus = 'Running' and juser = 
> 'jonhdoe';
> 
> Basically, I have a table that tracks the jobs I am running.
> 
> In my html, I'd like to replace this part (in red):
> 
> {% if object_list.last.jstatus == 'Running' %}
> <meta http-equiv="refresh" content="5"> <center><h0>Page automatically 
> refreshed every 5 seconds | {% now "jS M y H:i" %}</h0></center>
> {% else %}<center><h0>No running jobs.</h0></center>
> {% endif %}
> 
> ​with something equivalent to my query above where I need to know if there's 
> at least one job running for a given user.
> 
> I've been looking at 
> https://docs.djangoproject.com/en/2.0/ref/models/querysets 
> <https://docs.djangoproject.com/en/2.0/ref/models/querysets> ​but I couldn't 
> work out a solution.
> 
> ​Many thanks in advance,
> 
> Alan​
> 
> -- 
> I'll cycle across Britain in 2018 for a charity, would you consider
> supporting my cause? http://uk.virginmoneygiving.com/AlanSilva 
> <http://uk.virginmoneygiving.com/AlanSilva>
> Many thanks!
> --
> Alan Wilter SOUSA da SILVA, DSc
> Senior Bioinformatician, UniProt
> European Bioinformatics Institute (EMBL-EBI)
> European Molecular Biology Laboratory
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
> United Kingdom
> Tel: +44 (0)1223 494588
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAEznbznNwJW4omM%3DMncj8aoBcg3AW8r-yFTMMkb5ZBiB%3Dsv96Q%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAEznbznNwJW4omM%3DMncj8aoBcg3AW8r-yFTMMkb5ZBiB%3Dsv96Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7E9B0630-E1A7-4759-B082-998273D6B330%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to