some more cleaning, removing relative imports

This commit is contained in:
volpino 2012-05-13 14:09:22 +02:00
parent b339efe012
commit c85de09947
6 changed files with 24 additions and 25 deletions

View File

@ -1,5 +1,5 @@
from models import Package, Version, VersionLog, EuscanResult, Log, WorldLog, \
CategoryLog, HerdLog, MaintainerLog, Herd, Maintainer
from djeuscan.models import Package, Version, VersionLog, EuscanResult, \
Log, WorldLog, CategoryLog, HerdLog, MaintainerLog, Herd, Maintainer
from django.contrib import admin
admin.site.register(Herd)

View File

@ -64,16 +64,16 @@ def chart_name(name, **kwargs):
def getpackages(**kwargs):
packages = Package.objects
pkgs = Package.objects
if 'category' in kwargs and kwargs['category']:
packages = Package.objects.for_category(kwargs['category'])
pkgs = Package.objects.for_category(kwargs['category'])
if 'herd' in kwargs and kwargs['herd']:
packages = Package.objects.for_herd(kwargs['herd'])
pkgs = Package.objects.for_herd(kwargs['herd'])
if 'maintainer' in kwargs and kwargs['maintainer']:
packages = Package.objects.for_maintainer(kwargs['maintainer'])
pkgs = Package.objects.for_maintainer(kwargs['maintainer'])
return packages
return pkgs
def cached_pylab_chart(f):

View File

@ -62,15 +62,15 @@ class Package(models.Model):
objects = PackageManager()
@property
def homepages(self):
return self.homepage.split(' ')
class Meta:
unique_together = ['category', 'name']
def __unicode__(self):
return '%s/%s' % (self.category, self.name)
class Meta:
unique_together = ['category', 'name']
@property
def homepages(self):
return self.homepage.split(' ')
class Version(models.Model):
@ -87,15 +87,15 @@ class Version(models.Model):
urls = models.TextField(blank=True)
alive = models.BooleanField(default=True, db_index=True)
class Meta:
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
def __unicode__(self):
return '%s/%s-%s-%s:%s [%s]' % (
self.package.category, self.package.name, self.version,
self.revision, self.slot, self.overlay
)
class Meta:
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
class VersionLog(models.Model):
VERSION_ADDED = 1
@ -116,10 +116,6 @@ class VersionLog(models.Model):
objects = VersionLogManager()
def tag(self):
return '%s-%s:%s-[%s]' % (self.version, self.revision, self.slot,
self.overlay)
def __unicode__(self):
txt = '+ ' if self.action == self.VERSION_ADDED else '- '
txt += '%s/%s-%s-%s:%s [%s]' % (
@ -129,6 +125,10 @@ class VersionLog(models.Model):
)
return txt
def tag(self):
return '%s-%s:%s-[%s]' % (self.version, self.revision, self.slot,
self.overlay)
class EuscanResult(models.Model):
package = models.ForeignKey(Package)

View File

@ -4,8 +4,8 @@ register = template.Library()
@register.inclusion_tag('euscan/_packages.html', takes_context=True)
def packages(context, packages):
context['packages'] = packages
def packages(context, pkgs):
context['packages'] = pkgs
return context

View File

@ -1,6 +1,6 @@
from django.conf.urls.defaults import url, patterns, include
from feeds import PackageFeed, CategoryFeed, HerdFeed, MaintainerFeed, \
GlobalFeed
from djeuscan.feeds import PackageFeed, CategoryFeed, HerdFeed, \
MaintainerFeed, GlobalFeed
package_patterns = patterns('djeuscan.views',
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/feed/$',

View File

@ -8,8 +8,7 @@ from djeuscan.helpers import version_key, packages_from_names
from djeuscan.models import Version, Package, Herd, Maintainer, EuscanResult, \
VersionLog
from djeuscan.forms import WorldForm, PackagesForm
import charts
from djeuscan import charts
@render_to('euscan/index.html')