These are chat archives for allegro/ralph

19th
Apr 2017
Roman Prykhodchenko
@romcheg
Apr 19 2017 07:30
@ar4s that's the patch you were interested in allegro/ralph#3024
Arkadiusz Adamski
@ar4s
Apr 19 2017 07:37
@romcheg thanks!
Roman Prykhodchenko
@romcheg
Apr 19 2017 07:59
@mkurek looks like we can merge ^ now
Mateusz Kurek
@mkurek
Apr 19 2017 08:00
let's do it :)
xliiv
@xliiv
Apr 19 2017 08:06

i've got such query:

        qs = qs.annotate(                                                     
            vulnerabilities_count=Count('securityscan__vulnerabilities')       
        )

i'd like to update the query so it counts specific vuls. (vuls which has field patch_deadline greater than today)
how can i make it with django orm?

Mateusz Kurek
@mkurek
Apr 19 2017 08:29
btw @xliiv text with scan status in the last column on the listing could be url to security status tab for particular host
xliiv
@xliiv
Apr 19 2017 08:30
@mkurek i'll add it
xliiv
@xliiv
Apr 19 2017 08:56
        from django.db.models.fields import CharField, Field                  
          qs = qs.annotate(                                                     
              vulnerabilities_count=Count(                                      
                  Case(                                                         
                      When(                                                     
                        securityscan__vulnerability__patch_deadline__gte=datetime.now(),
                          then=1,                                               
                      ),                                                        
                      output_field=CharField(),                                 
                  ),                                                            
              )                                                                 
          )
this gives:
django.core.exceptions.FieldError: Relation fields do not support nested lookups
xliiv
@xliiv
Apr 19 2017 09:03
ok, i spot one error securityscan__vulnerabilities__patch_deadline__gte=1,
xliiv
@xliiv
Apr 19 2017 09:14
@mkurek how can i reverse that url?
admin:virtual_cloudhost_security_cloudhost_security_info because it depends on different apps?
Mateusz Kurek
@mkurek
Apr 19 2017 09:16
use get_admin_url from ralph.admin.helpers
xliiv
@xliiv
Apr 19 2017 10:44
@mkurek is it possible to run for extra-view? os should i use code from there to create another fn for extra-views?
xliiv
@xliiv
Apr 19 2017 13:11
allegro/ralph#3026
@mkurek @ar4s @szok
.. and this one: allegro/ralph#3025
@mkurek @szok @romcheg