Open Jagl257 opened 4 years ago
Solved this one, the documentation in this link is mistaken.
The problem is that it is not ArrayModelField but only ArrayField
class attack(models.Model):
succesfullInjections = models.ArrayModelField(
model_container = succesfull_injections,
)
successSQLI = models.CharField(max_length=100)
time = models.CharField(max_length = 100)
triedInjections = models.CharField(max_length = 100)
The correct would be:
class attack(models.Model):
succesfullInjections = models.ArrayField(
model_container = succesfull_injections,
)
successSQLI = models.CharField(max_length=100)
time = models.CharField(max_length = 100)
triedInjections = models.CharField(max_length = 100)
@nesdis I think this link may be deprecated.
Now I'm having the following issue #417
@Jagl257 I think you are right. I realised one more issue while trying to make ArrayField
work. If your succesfull_injections
has only 1 attribute you won't get any errors what so ever with ArrayField
.
However, If you have multiple attributes/objects inside of succesful_injection
you'll get the same error as #417
@nesdis
Hey @Jagl257, solved this issue here
Its strange. Actually I am getting this error
AttributeError: module 'djongo.models' has no attribute 'ArrayField'
However with ArrayModelField I get a different error.
TypeError at /speechAPI/ isinstance() arg 2 must be a type or tuple of types
Here is my code if anyone could help.
from appconf import AppConf
from djongo import models
from django import forms
class Words(models.Model):
duration = models.DurationField()
offset = models.TimeField()
class Meta:
abstract = True
class WordsForm(forms.ModelForm):
class Meta:
model = Words
fields = ('duration', 'offset')
class Transcript(models.Model):
display_text = models.TextField()
words = models.ArrayModelField(model_container=Words,model_form_class=WordsForm)
class Meta:
abstract = True
class Transcription(models.Model):
request_id = models.CharField(max_length=100)
q_id = models.BigIntegerField()
source = models.CharField(max_length=100)
transcript = models.EmbeddedModelField(model_container=Transcript)
objects = models.DjongoManager()
Any insight into the error would be greatly appreciated.
Can you mention the version of Djongo and Django you are on?
Django==2.2.12 Djongo==1.2.38
I have now upgraded djongo to 1.3.2. Now whenever I try to use
models.EmbeddedField(model_container=Transcript)
It gives the following error:
raise AppRegistryNotReady("Models aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
Hi @Invincible166 I'm having the same issue. See #417
Error when adding an ArrayModelField to models.
Following djongo tutorial: https://djongo.readthedocs.io/docs/array-model-field/
Using:
Python script
in models.py django project
Traceback
StackOverflow question : https://stackoverflow.com/questions/62026138/djongo-models-has-no-attribute-arraymodelfield