All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Halstead" <mhalstead@linuxfoundation.org>
To: yocto@lists.yoctoproject.org
Cc: Michael Halstead <mhalstead@linxufoundation.org>
Subject: [error-report-web][PATCH 4/5] Search on contains, enalble admin, and keep more error history.
Date: Thu, 25 Mar 2021 16:56:36 -0700	[thread overview]
Message-ID: <20210325235637.647556-4-mhalstead@linuxfoundation.org> (raw)
In-Reply-To: <20210325235637.647556-1-mhalstead@linuxfoundation.org>

From: Michael Halstead <mhalstead@linxufoundation.org>

---
 Post/feed.py    | 2 +-
 Post/purge.py   | 5 +++--
 Post/views.py   | 3 +--
 project/urls.py | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Post/feed.py b/Post/feed.py
index 7e5bfdb..5d57b54 100644
--- a/Post/feed.py
+++ b/Post/feed.py
@@ -27,7 +27,7 @@ class LatestEntriesFeed(Feed):
         if self.mode == results_mode.SPECIAL_SUBMITTER and hasattr(settings,"SPECIAL_SUBMITTER"):
             #Special submitter mode see settings.py to enable
             name = settings.SPECIAL_SUBMITTER['name']
-            queryset = BuildFailure.objects.order_by('-BUILD__DATE').filter(BUILD__NAME__istartswith=name)[:self.limit]
+            queryset = BuildFailure.objects.order_by('-BUILD__DATE').filter(BUILD__NAME__icontains=name)[:self.limit]
 
         else:
             queryset = BuildFailure.objects.order_by('-BUILD__DATE')[:self.limit]
diff --git a/Post/purge.py b/Post/purge.py
index 1289d13..dd58441 100644
--- a/Post/purge.py
+++ b/Post/purge.py
@@ -15,11 +15,12 @@ def setup_django():
 def main():
     setup_django()
     from Post.models import BuildFailure
-    delete_before = timezone.now()-timedelta(days=30)
+    delete_before = timezone.now()-timedelta(days=45)
     query = "SELECT bf.id FROM Post_buildfailure bf LEFT JOIN Post_build b ON (bf.BUILD_id = b.id) WHERE bf.REFERER NOT IN ('OTHER','NO_REFERER') AND b.DATE < '{0}'".format(delete_before.date())
-    print query
+    #print query
     items = BuildFailure.objects.raw(query)
     for item in items:
+        print "Deleting: ", item.id
         item.delete()
 
 if __name__ == "__main__":
diff --git a/Post/views.py b/Post/views.py
index 0ad58ba..7791201 100644
--- a/Post/views.py
+++ b/Post/views.py
@@ -45,7 +45,6 @@ def common_context(request):
 
     return ret
 
-
 @csrf_exempt
 def addData(request, return_json=False):
     response = ''
@@ -208,7 +207,7 @@ def search(request, mode=results_mode.LATEST, **kwargs):
     if mode == results_mode.SPECIAL_SUBMITTER and hasattr(settings,"SPECIAL_SUBMITTER"):
         #Special submitter mode see settings.py to enable
         name = settings.SPECIAL_SUBMITTER['name']
-        items = items.filter(BUILD__NAME__istartswith=name)
+        items = items.filter(BUILD__NAME__icontains=name)
 
     elif mode == results_mode.SEARCH and "query" in request.GET:
         query = request.GET["query"]
diff --git a/project/urls.py b/project/urls.py
index 1f51c7c..c1ac55f 100644
--- a/project/urls.py
+++ b/project/urls.py
@@ -24,7 +24,7 @@ urlpatterns = patterns('',
     #url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
     # Uncomment the next line to enable the admin:
-    #url(r'^admin/', include(admin.site.urls)),
+    url(r'^admin/', include(admin.site.urls)),
     #url(r'^accounts/', include('registration.backends.default.urls')),
     url(r'^(?i)Errors/Latest/$', 'Post.views.search', { 'mode' : results_mode.LATEST }, name= "latest_errors"),
     url(r'^(?i)Errors/Latest/feed$', LatestEntriesFeed(), name="errors_feed"),
-- 
2.11.0


  parent reply	other threads:[~2021-03-25 23:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 23:56 [error-report-web][PATCH 1/5] purge.py: Create script that will purge database Michael Halstead
2021-03-25 23:56 ` [error-report-web][PATCH 2/5] Avoid errors caused by attempting to update referrers for objects that don't exist Michael Halstead
2021-03-25 23:56 ` [error-report-web][PATCH 3/5] Allow alternate settings, avoid out of memory condition Michael Halstead
2021-03-25 23:56 ` Michael Halstead [this message]
2021-03-25 23:56 ` [error-report-web][PATCH 5/5] Import parser from the new python3 location Michael Halstead
2021-03-26 18:49 [error-report-web][PATCH 1/5] purge.py: Create script that will purge database Michael Halstead
2021-03-26 18:49 ` [error-report-web][PATCH 4/5] Search on contains, enalble admin, and keep more error history Michael Halstead

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325235637.647556-4-mhalstead@linuxfoundation.org \
    --to=mhalstead@linuxfoundation.org \
    --cc=mhalstead@linxufoundation.org \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.