Sto provando ad aggiornare da Django 1.7.1 a 1.8 sul mio dev env. Mi sembra di avere un problema con uno dei miei modelli, penso che un file core sia stato aggiornato e che abbia problemi con il mio modello. Non riesco a capire cosa sta causando la morte.L'override della classe Django fallisce Controllo del sistema
Questo è l'unico errore che ottengo quando si tenta di eseguire un test manage.py
CommandError: System check identified some issues:
ERRORS:
graphite_alerts.CheckResults: (models.E020) The 'CheckResults.check()' class method is currently overridden by <django.db.models.fields.related.ReverseSingleRelatedObjectDescriptor object at 0x3a76310>.
Ho provato a cambiare il nome della classe e mi guardai intorno il mio modello e cant sembrano trovare nulla che possa essere la causa di un errore di esclusione
Questa è la classe:
class CheckResults(models.Model):
WARN = 'warn'
ERROR = 'error'
OK = 'ok'
DOWN = 'down'
STATUS_CHOICES = (
(WARN, 'Warn'),
(ERROR, 'Error'),
(OK, 'OK'),
(DOWN, 'Down'),
)
target = models.CharField(max_length=1000)
additional_graph_target = models.CharField(max_length=1000, blank=True)
value = models.DecimalField(max_digits=9, decimal_places=2)
timestamp = models.DateTimeField(db_index=True)
status = models.CharField(max_length=6, choices=STATUS_CHOICES, default='ok')
check = models.ForeignKey(Check, related_name='results')
tags = TaggableManager()
def __unicode__(self):
return self.target
@models.permalink
def get_absolute_url(self):
return ('graphite-check-result-list-view',(), {'pk': self.check.pk, 'target': self.target})
def generate_graphite_image_url(self):
params = { }
params['target'] = []
params['target'].append(self.target)
params['target'].append('threshold(' + str(self.check.warn) + ',"Warn","yellow")')
params['target'].append('threshold(' + str(self.check.error) + ',"Error","red")')
params['from'] = '-7days'
params['width'] = '900'
params['minorGridLineColor'] = 'C0C0C0'
params['majorGridLineColor'] = 'C0C0C0'
params['bgcolor'] = '333333'
request = requests.get(self.check.GRAPHITE_URL+self.check.RENDER_PAGE,params=params)
return urllib2.unquote(request.url.decode('UTF-8'))
def generate_additional_graphite_image_url(self):
params = { }
params['target'] = []
params['target'].append(self.additional_graph_target)
params['target'].append('threshold(' + str(self.check.warn) + ',"Warn","yellow")')
params['target'].append('threshold(' + str(self.check.error) + ',"Error","red")')
params['from'] = '-7days'
params['width'] = '900'
params['minorGridLineColor'] = 'C0C0C0'
params['majorGridLineColor'] = 'C0C0C0'
params['bgcolor'] = '333333'
request = requests.get(self.check.GRAPHITE_URL+self.check.RENDER_PAGE,params=params)
return urllib2.unquote(request.url.decode('UTF-8'))
class Meta:
ordering = ("timestamp",)
unique_together = (("target", "timestamp"),)
Django 1.8 non è stato ancora pubblicato. Continua con 1.7.X per ora. – Alasdair
Grazie! Ho appena finito di fare ulteriori indagini e sembra che alle versioni più recenti non piaccia avere variabili chiamate dopo le classi. Ho avuto un controllo di classe e un controllo variabile. ho solo bisogno di capire come farli funzionare insieme! Grazie per la risposta rapida! – Joey