Hi,

Weirdly, I've just been doing this. What do you have in your settings
INSTALLED_APPS?

One of them should be something like 'employer.apps.EmployerConfig'
alternatively in your employer module's __init__.py file you need to say
default_app_config = 'employer.apps.EmployerConfig'

Dan

On 24 June 2018 at 14:45, Dejan Spasić <[email protected]> wrote:

> I don't wont to bother you with a long text and will first show you the
> code. I think this should be self explanatory. If not, let me know :)
>
> #####################
>
> from typing import Any, Dict
>
> from django.apps import AppConfig
> from django.db.models.signals import post_save
>
> from django.contrib.auth.models import User
> from .models import Employer
>
>
> class EmployerConfig(AppConfig):
>     name = "employer"
>     verbose_name = "Employer"
>
>     def ready(self) -> None:
>         def post_save_user(**kwargs: Dict[str, Any]) -> None:
>             if kwargs['created']:
>                 return None
>
>             user: User = kwargs['instance']
>
>             if user.employer:
>                 return None
>
>             employer = Employer(user=user)
>             employer.save()
>
>         post_save.connect(post_save_user, User)#####################
>
>
> As you can see I want to create an employer and link them with the new 
> created user.
>
> Running the command
>
> ./manager.py createsuperuser --username username --email [email protected] 
> ***********
>
> shows me that I'm wrong. There is no entry in the myapp_employer table. What 
> did I missend?
>
>
> * Django: 2.0.X
> * app is installed
>
> * python: 3.6
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/8d0c4241-3d1a-46c9-9e52-6cc4f46a3906%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8d0c4241-3d1a-46c9-9e52-6cc4f46a3906%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Wildman and Herring Limited, Registered Office: 28 Brock Street, Bath,
United Kingdom, BA1 2LN, Company no: 05766374

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPZHCY562U_NDqLeKgfEGvGOz3Un9u8k0RHaiHTg_AYts_UFzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to