euscanwww: Added RefreshPackageQuery to models
Allows storing queries for refresh requests by users Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
33555a9fbe
commit
8913f826de
@ -0,0 +1,139 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
# Adding model 'RefreshPackageQuery'
|
||||||
|
db.create_table('djeuscan_refreshpackagequery', (
|
||||||
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
('query', self.gf('django.db.models.fields.CharField')(unique=True, max_length=256)),
|
||||||
|
('priority', self.gf('django.db.models.fields.IntegerField')(default=0)),
|
||||||
|
))
|
||||||
|
db.send_create_signal('djeuscan', ['RefreshPackageQuery'])
|
||||||
|
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_gentoo'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_gentoo_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, on_delete=models.SET_NULL, to=orm['djeuscan.Version']))
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_overlay'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_overlay_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, on_delete=models.SET_NULL, to=orm['djeuscan.Version']))
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_upstream'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_upstream_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, on_delete=models.SET_NULL, to=orm['djeuscan.Version']))
|
||||||
|
def backwards(self, orm):
|
||||||
|
# Deleting model 'RefreshPackageQuery'
|
||||||
|
db.delete_table('djeuscan_refreshpackagequery')
|
||||||
|
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_gentoo'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_gentoo_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['djeuscan.Version']))
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_overlay'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_overlay_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['djeuscan.Version']))
|
||||||
|
|
||||||
|
# Changing field 'Package.last_version_upstream'
|
||||||
|
db.alter_column('djeuscan_package', 'last_version_upstream_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['djeuscan.Version']))
|
||||||
|
models = {
|
||||||
|
'djeuscan.categorylog': {
|
||||||
|
'Meta': {'object_name': 'CategoryLog', '_ormbases': ['djeuscan.Log']},
|
||||||
|
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'djeuscan.euscanresult': {
|
||||||
|
'Meta': {'object_name': 'EuscanResult'},
|
||||||
|
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||||
|
'result': ('django.db.models.fields.TextField', [], {'blank': 'True'})
|
||||||
|
},
|
||||||
|
'djeuscan.herd': {
|
||||||
|
'Meta': {'object_name': 'Herd'},
|
||||||
|
'email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'djeuscan.herdlog': {
|
||||||
|
'Meta': {'object_name': 'HerdLog', '_ormbases': ['djeuscan.Log']},
|
||||||
|
'herd': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Herd']"}),
|
||||||
|
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||||
|
},
|
||||||
|
'djeuscan.log': {
|
||||||
|
'Meta': {'object_name': 'Log'},
|
||||||
|
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'n_packages_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_packages_outdated': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_packages_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_versions_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_versions_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_versions_upstream': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'djeuscan.maintainer': {
|
||||||
|
'Meta': {'object_name': 'Maintainer'},
|
||||||
|
'email': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||||
|
},
|
||||||
|
'djeuscan.maintainerlog': {
|
||||||
|
'Meta': {'object_name': 'MaintainerLog', '_ormbases': ['djeuscan.Log']},
|
||||||
|
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'}),
|
||||||
|
'maintainer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Maintainer']"})
|
||||||
|
},
|
||||||
|
'djeuscan.package': {
|
||||||
|
'Meta': {'unique_together': "(['category', 'name'],)", 'object_name': 'Package'},
|
||||||
|
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'herds': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Herd']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'homepage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'last_version_gentoo': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_gentoo'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||||
|
'last_version_overlay': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_overlay'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||||
|
'last_version_upstream': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_upstream'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||||
|
'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Maintainer']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'n_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||||
|
},
|
||||||
|
'djeuscan.refreshpackagequery': {
|
||||||
|
'Meta': {'object_name': 'RefreshPackageQuery'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'query': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'})
|
||||||
|
},
|
||||||
|
'djeuscan.version': {
|
||||||
|
'Meta': {'unique_together': "(['package', 'slot', 'revision', 'version', 'overlay'],)", 'object_name': 'Version'},
|
||||||
|
'alive': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128', 'db_index': 'True'}),
|
||||||
|
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||||
|
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'slot': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'urls': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||||
|
},
|
||||||
|
'djeuscan.versionlog': {
|
||||||
|
'Meta': {'object_name': 'VersionLog'},
|
||||||
|
'action': ('django.db.models.fields.IntegerField', [], {}),
|
||||||
|
'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128'}),
|
||||||
|
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||||
|
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'slot': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||||
|
},
|
||||||
|
'djeuscan.worldlog': {
|
||||||
|
'Meta': {'object_name': 'WorldLog', '_ormbases': ['djeuscan.Log']},
|
||||||
|
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['djeuscan']
|
@ -115,12 +115,12 @@ class Version(models.Model):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
package = models.ForeignKey(Package)
|
package = models.ForeignKey(Package)
|
||||||
slot = models.CharField(max_length=128)
|
slot = models.CharField(max_length=128, blank=True)
|
||||||
revision = models.CharField(max_length=128)
|
revision = models.CharField(max_length=128)
|
||||||
version = models.CharField(max_length=128)
|
version = models.CharField(max_length=128)
|
||||||
packaged = models.BooleanField()
|
packaged = models.BooleanField()
|
||||||
overlay = models.CharField(max_length=128, default='gentoo', db_index=True,
|
overlay = models.CharField(max_length=128, default='gentoo', db_index=True,
|
||||||
validators=[validate_name])
|
validators=[validate_name], blank=True)
|
||||||
urls = models.TextField(blank=True)
|
urls = models.TextField(blank=True)
|
||||||
alive = models.BooleanField(default=True, db_index=True)
|
alive = models.BooleanField(default=True, db_index=True)
|
||||||
|
|
||||||
@ -148,12 +148,12 @@ class VersionLog(models.Model):
|
|||||||
|
|
||||||
package = models.ForeignKey(Package)
|
package = models.ForeignKey(Package)
|
||||||
datetime = models.DateTimeField(auto_now_add=True)
|
datetime = models.DateTimeField(auto_now_add=True)
|
||||||
slot = models.CharField(max_length=128)
|
slot = models.CharField(max_length=128, blank=True)
|
||||||
revision = models.CharField(max_length=128)
|
revision = models.CharField(max_length=128)
|
||||||
version = models.CharField(max_length=128)
|
version = models.CharField(max_length=128)
|
||||||
packaged = models.BooleanField()
|
packaged = models.BooleanField()
|
||||||
overlay = models.CharField(max_length=128, default='gentoo',
|
overlay = models.CharField(max_length=128, default='gentoo',
|
||||||
validators=[validate_name])
|
validators=[validate_name], blank=True)
|
||||||
action = models.IntegerField(choices=VERSION_ACTIONS)
|
action = models.IntegerField(choices=VERSION_ACTIONS)
|
||||||
|
|
||||||
objects = VersionLogManager()
|
objects = VersionLogManager()
|
||||||
@ -257,3 +257,14 @@ class MaintainerLog(Log):
|
|||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s %s' % (self.maintainer, Log.__unicode__(self))
|
return u'%s %s' % (self.maintainer, Log.__unicode__(self))
|
||||||
|
|
||||||
|
|
||||||
|
class RefreshPackageQuery(models.Model):
|
||||||
|
query = models.CharField(max_length=256, unique=True)
|
||||||
|
priority = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
get_latest_by = "priority"
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return u'[%d] %s' % (self.priority, self.query)
|
||||||
|
Loading…
Reference in New Issue
Block a user