Hi guys i´m using Django 1.7 and mysql to create an application and I´m receiving this error
ValueError at /Cannot create form field for 'radiotipo_idradiotipo' yet, because its related model u'Radioinfo' has not been loaded yet
I don´t know what is this. this error happenes on my forms.py, here´s the code: forms.py
from django import forms
from models import Node, Datasource, Radio, Radiotipo, Snapshot, Tag, Taginfo, Valores
class NodeForm(forms.ModelForm):
class Meta:
model = Node
class DatasourceForm(forms.ModelForm):
class Meta:
model = Datasource
class RadiotipoForm(forms.ModelForm):
class Meta:
model = Radiotipo
class SnapshotForm(forms.ModelForm):
class Meta:
model = Snapshot
class TagForm(forms.ModelForm):
class Meta:
model = Tag
class TaginfoForm(forms.ModelForm):
class Meta:
model = Taginfo
class ValoresForm(forms.ModelForm):
class Meta:
model = Valores
class RadioForm(forms.ModelForm):
class Meta:
model = Radio
and here is my models.py
class Datasource(models.Model):
objects = GChartsManager()
idestacao_meteo = models.IntegerField(db_column='idDATASOURCE', primary_key=True, editable=False) # Field name made lowercase.
nome_estacao = models.CharField(db_column='NAME', max_length=45) # Field name made lowercase.
fabricante = models.CharField(db_column='MANUFACTURER', max_length=45, blank=True) # Field name made lowercase.
modelo = models.CharField(db_column='MODEL', max_length=45, blank=True) # Field name made lowercase.
node_idnode = models.ForeignKey('Node', db_column='site_idSITE', blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'datasource'
class Node(models.Model):
objects = GChartsManager()
idnode = models.IntegerField(db_column='idSITE', primary_key=True, editable=False) # Field name made lowercase.
nome = models.CharField(db_column='NAME', max_length=45) # Field name made lowercase.
informacoes = models.CharField(db_column='DESCRIPTION', max_length=45, blank=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'site'
class Radio(models.Model):
objects = GChartsManager()
idradio = models.IntegerField(db_column='idRADIO', primary_key=True, editable=False)
endreal = models.CharField(db_column='ENDREAL', max_length=64, blank=True) # Field name made lowercase.
radiotipo_idradiotipo = models.ForeignKey('Radioinfo', db_column='radioInfo_idRADIOINFO') # Field name made lowercase.
datasource_idestacao_meteo = models.ForeignKey(Datasource, db_column='datasource_idDATASOURCE', blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'radio'
class Radiotipo(models.Model):
objects = GChartsManager()
idradiotipo = models.IntegerField(db_column='idRADIOINFO', primary_key=True, editable=False) # Field name made lowercase.
nome = models.CharField(db_column='NAME', max_length=45)
descricao = models.CharField(db_column='DESCRIPTION', max_length=300, blank=True)
class Meta:
managed = False
db_table = 'radioinfo'
class Snapshot(models.Model):
objects = GChartsManager()
idsnap = models.IntegerField(db_column='idSNAP', primary_key=True, editable=False) # Field name made lowercase.
valor = models.FloatField(db_column='VALUE', blank=True, null=True) # Field name made lowercase.
snapshot = models.DateTimeField(db_column='SNAPSHOT', blank=True, null=True) # Field name made lowercase.
tag_idtag = models.ForeignKey('Tag', db_column='tag_idTAG') # Field name made lowercase.
class Meta:
managed = False
db_table = 'snapshot'
class Tag(models.Model):
objects = GChartsManager()
idtag = models.IntegerField(db_column='idTAG', primary_key=True, editable=False) # Field name made lowercase.
desvio = models.FloatField(db_column='DEVIATION', blank=True, null=True) # Field name made lowercase.
tempo_max = models.IntegerField(db_column='TIME_MAX', blank=True, null=True) # Field name made lowercase.
conv_rate = models.IntegerField(db_column='CONV_RATE', blank=True, null=True) # Field name made lowercase.
taginfo_idtaginfo1 = models.ForeignKey('Taginfo', db_column='tagInfo_idTAGINFO') # Field name made lowercase.
datasource_idestacao_meteo = models.ForeignKey(Datasource, db_column='datasource_idDATASOURCE', blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'tag'
class Taginfo(models.Model):
objects = GChartsManager()
idtaginfo = models.IntegerField(db_column='idTAGINFO', primary_key=True, editable=False) # Field name made lowercase.
nome = models.CharField(db_column='NAME', max_length=45) # Field name made lowercase.
descricao = models.CharField(db_column='DESCRIPTION', max_length=255, blank=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'taginfo'
class Valores(models.Model):
objects = GChartsManager()
idvalores = models.IntegerField(db_column='idVALUES', primary_key=True, editable=False) # Field name made lowercase.
valor = models.FloatField(db_column='VALUE') # Field name made lowercase.
datahora = models.DateTimeField(db_column='DATETIME') # Field name made lowercase.
tag_idtag = models.ForeignKey(Tag, db_column='tag_idTAG') # Field name made lowercase.
class Meta:
managed = False
db_table = 'values'
Thanks for helping.
Aucun commentaire:
Enregistrer un commentaire