Commit 63277edc authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

Project: updated, repos, rpkgs

parent 21103fe5
......@@ -111,9 +111,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'fr-FR'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Paris'
USE_I18N = True
......
# Generated by Django 2.0.1 on 2018-01-31 17:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rainboard', '0010_robotpkg'),
]
operations = [
migrations.AlterField(
model_name='project',
name='updated',
field=models.DateTimeField(blank=True, null=True),
),
]
......@@ -163,6 +163,7 @@ class Project(Links, NamedModel, TimeStampedModel):
articles = models.ManyToManyField(Article)
description = models.TextField()
version = models.CharField(max_length=20, blank=True, null=True)
updated = models.DateTimeField(blank=True, null=True)
# TODO: release github ↔ robotpkg
def get_absolute_url(self):
......@@ -222,6 +223,20 @@ class Project(Links, NamedModel, TimeStampedModel):
self.__dict__[value] = search.groups()[0].strip(''' \r\n\t'"''')
self.save()
def repos(self):
return self.repo_set.count()
def rpkgs(self):
return self.robotpkg_set.count()
def update(self, pull=True):
git_repo = self.git()
if pull:
for repo in self.repo_set.all():
repo.git().fetch()
self.updated = git_repo.commit().authored_datetime
self.save()
class Repo(TimeStampedModel):
name = models.CharField(max_length=200)
......
......@@ -29,9 +29,12 @@ class NamespaceTable(StrippedTable):
class ProjectTable(StrippedTable):
repos = tables.Column(accessor='repos', orderable=False)
rpkgs = tables.Column(accessor='rpkgs', orderable=False)
class Meta:
model = models.Project
fields = ('main_namespace', 'name', 'license', 'homepage')
fields = ('main_namespace', 'name', 'license', 'homepage', 'updated')
def render_name(self, record):
return record.get_link()
......
......@@ -27,6 +27,7 @@
<dt>Description</dt> <dd>{{ project.description }}</dd>
<dt>Version</dt> <dd>{{ project.version|default:"—" }}</dd>
<dt>Homepage</dt> <dd>{% if project.homepage %}<a href="{{ project.homepage }}">{{ project.homepage }}</a>{% else %}—{% endif %}</dd>
<dt>Updated</dt> <dd>{{ project.updated }}</dd>
</dl>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment