2

This is my code in my signals.py

from .models import Entry

@receiver(pre_save, sender=Entry)
def do_stuff(sender, instance, *args, **kwargs):
    pass

Now this questions is related

Django 1.9 deprecation warnings app_label

But I am not able to figure out why I need to create extra class for that.

Warning:

Model class app.models.Entry doesn't declare an explicit app_label and either isn't in
an application in INSTALLED_APPS or else was imported before its application was loaded.
This will no longer be supported in Django 1.9.

If I just empty my signals file then there is no warning. The issue is using .models in signals as mentioned in that question

2
  • What is the exact warning you get?
    – user764357
    May 21, 2015 at 5:14
  • I have answered the question you link to, have a look. May 30, 2015 at 9:33

2 Answers 2

0

This is mostly likely because your application is not in the INSTALLED_APPS within your settings.py

0

I also got this error, what I found the error is in model import before it exist.

I used this to import model and it works for me

from django.apps import apps
model_obj = apps.get_model('app_name', 'model_name')
model_obj.objects.get() ...etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.