From: "Slava Bacherikov" <slava@bacherikov.org.ua>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/apps/packages/templatetags/, ...
Date: Fri, 15 Jun 2012 23:28:01 +0000 (UTC) [thread overview]
Message-ID: <1339778476.cd472edeab4c8759179b7eb4a89ac6cd7ab4c601.bacher09@gentoo> (raw)
commit: cd472edeab4c8759179b7eb4a89ac6cd7ab4c601
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jun 15 16:41:16 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jun 15 16:41:16 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=cd472ede
Save info about repository update time
---
gpackages/apps/packages/models.py | 3 +--
gpackages/apps/packages/scan.py | 4 ++++
gpackages/apps/packages/templatetags/packages.py | 10 ++++++++++
gpackages/template/base.html | 4 +++-
gpackages/template/last_updated.html | 1 +
5 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 612de5b..c2b62ac 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -28,10 +28,9 @@ class ArchesModel(models.Model):
def __unicode__(self):
return self.name
-class RepositoryModel(models.Model):
+class RepositoryModel(AbstractDateTimeModel):
name = models.CharField(unique = True, max_length = 60)
description = models.TextField(blank = True, null = True)
- # And other fields
def __unicode__(self):
return self.name
diff --git a/gpackages/apps/packages/scan.py b/gpackages/apps/packages/scan.py
index f4c6377..d716380 100644
--- a/gpackages/apps/packages/scan.py
+++ b/gpackages/apps/packages/scan.py
@@ -312,6 +312,10 @@ class Scanner(object):
repo_obj, repo_created = models.RepositoryModel \
.objects.get_or_create(name = repo.name)
+ if not repo_created:
+ #Update modification time
+ repo_obj.save(force_update = True)
+
self.scanpackages(repo, repo_obj, **kwargs)
diff --git a/gpackages/apps/packages/templatetags/__init__.py b/gpackages/apps/packages/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/gpackages/apps/packages/templatetags/packages.py b/gpackages/apps/packages/templatetags/packages.py
new file mode 100644
index 0000000..abe1039
--- /dev/null
+++ b/gpackages/apps/packages/templatetags/packages.py
@@ -0,0 +1,10 @@
+from django import template
+
+register = template.Library()
+
+from ..models import RepositoryModel
+
+@register.inclusion_tag('last_updated.html')
+def last_updated():
+ l = RepositoryModel.objects.only('updated_datetime').latest('updated_datetime')
+ return {'last_updated': l.updated_datetime}
diff --git a/gpackages/template/base.html b/gpackages/template/base.html
index b63314b..5347af5 100644
--- a/gpackages/template/base.html
+++ b/gpackages/template/base.html
@@ -1,4 +1,5 @@
{% load url from future %}
+{% load packages %}
<!DOCTYPE html>
<html lang="en">
<head>
@@ -102,7 +103,8 @@ Text
<div class="well">
<div id="rightcontent">
<div>
- <span class="label label-info" style="display: block"> Last update</span>11 Jun 2012<br/> 10:47 UTC
+ <span class="label label-info" style="display: block"> Last update</span>
+ {% last_updated %}
</div><br/>
<div>
<span class="left-legend label label-info" style="display: block;">Legend</span>
diff --git a/gpackages/template/last_updated.html b/gpackages/template/last_updated.html
new file mode 100644
index 0000000..83e9d44
--- /dev/null
+++ b/gpackages/template/last_updated.html
@@ -0,0 +1 @@
+{{ last_updated|date:"d M Y" }} <br /> {{ last_updated|date:"H:i:s" }}
next reply other threads:[~2012-06-15 23:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 23:28 Slava Bacherikov [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-06-27 22:52 [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/apps/packages/templatetags/, Slava Bacherikov
2012-06-28 23:59 Slava Bacherikov
2012-07-18 23:03 Slava Bacherikov
2012-07-30 23:30 Slava Bacherikov
2012-07-31 14:22 Slava Bacherikov
2012-07-31 14:22 Slava Bacherikov
2012-08-02 22:44 Slava Bacherikov
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=1339778476.cd472edeab4c8759179b7eb4a89ac6cd7ab4c601.bacher09@gentoo \
--to=slava@bacherikov.org.ua \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox