Agregué la clase de usuario para el registro AdvUser Cuando quiero iniciar sesión o registrarme, o crear un superusuario, recibo un error:

Exception Value: no such table: vacancy_list_advuser

File "/home/alex/dev/python/django/junjob/myvenv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 305, in execute return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table: vacancy_list_advuser

Lo que hice

  1. ComprobadoAUTH_USER_MODEL = 'vacancy_list.AdvUser' # <app_name.model_name>
  2. Se eliminaron todas las migraciones en vacancy_list/migrations y luego se realizaron migraciones y migraciones.
  3. python manage.py migrar --run-syncdb

¿Qué debo hacer para resolver el problema?

ingrese la descripción de la imagen aquí

Mi código:

modelos.py

from django.conf import settings
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.dispatch import Signal

from .utilities import send_activation_notification


class Company(models.Model):
    name = models.CharField(max_length=200)
    about = models.TextField()

    def __str__(self):
        return self.name


class Vacancy(models.Model):
    company_key = models.ForeignKey(Company, on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    salary = models.CharField(max_length=200, default='40.000')
    text = models.TextField(default="The text about vacancy")
    city = models.CharField(max_length=200, default='Москва')
    date_str = models.CharField(max_length=50, default='12 сентября')

    created_date = models.DateTimeField(default=timezone.now)
    published_date = models.DateTimeField(blank=True, null=True)

    def publish(self):
        self.published_date = timezone.now()
        self.save()

    def __str__(self):
        return self.title


class AdvUser(AbstractUser):
    """ Model of user for registration """
    is_activated = models.BooleanField(default=True, db_index=True, verbose_name='Прошёл активацию?')
    send_messages = models.BooleanField(default=True, verbose_name='Слать оповещёния о новых комментариях?')

    class Meta(AbstractUser.Meta):
        pass


user_registrated = Signal(providing_args=['instance'])


def user_registrated_dispatcher(sender, **kwargs):
    send_activation_notification(kwargs['instance'])


user_registrated.connect(user_registrated_dispatcher)

urls.py

urlpatterns = [
    path('', HomePageView.as_view(), name='vacancy_list'),
    path('search/', SearchResultsView.as_view(), name='search_results'),
    path('vacancy/<int:pk>/', views.vacancy_detail, name='vacancy_detail'),

    path('accounts/login/', BBLoginView.as_view(), name='login'),
    path('accounts/profile/', profile, name='profile'),
    path('accounts/logout/', BBLogoutView.as_view(), name='logout'),

    path('accounts/register/done', RegisterDoneView.as_view(), name='register_done'),
    path('accounts/register/', RegisterUserView.as_view(), name='register'),
    path('accounts/register/activate/<str:sign>/', user_activate, name='register_activate'),
    # path('', views.post_list, name='post_list'),
]

vistas.py

''' Registration views '''

class BBLoginView(LoginView):
    template_name = 'vacancy_list/login.html'

class BBLogoutView(LoginRequiredMixin, LogoutView):
    template_name = 'vacancy_list/logout.html'

@login_required
def profile(request):
    return render(request, 'vacancy_list/profile.html')

class RegisterUserView(CreateView):
    model = AdvUser
    template_name = 'vacancy_list/register_user.html'
    form_class = RegisterUserForm
    success_url = reverse_lazy('register_done')

class RegisterDoneView(TemplateView):
    template_name = "vacancy_list/register_done.html"


def user_activate(request, sign):
    try:
        username = signer.unsign(sign)
    except:
        return render(request, 'vacancy_list/bad_signature.html')
    user = get_object_or_404(AdvUser, username=username)
    if user.is_activated:
        template = 'vacancy_list/user_is_activated.html'
    else:
        template = 'vacancy_list/activation_done.html'
        user.is_active = True
        user.is_activated = True
        user.save()
    return render(request, template)

base.html --> enlaces al registro

{% load static %}
<html>
    <head>
        <title>My blog</title>
        <!-- Add Bootstrap4 -->
        <link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">


        <style>
            html,
            body {
              height: 100%;
            }

            #page-content {
              flex: 1 0 auto;
            }

            #sticky-footer {
              flex-shrink: none;
            }
        </style>
    </head>

    <body class="d-flex flex-column">
        <div id="page-content">
                <!-- Navigation -->
          <nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
            <div class="container">
              <a class="navbar-brand" href="/">JunJob</a>
              <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
              </button>
              <div class="collapse navbar-collapse" id="navbarResponsive">
                <ul class="navbar-nav ml-auto">
                  <li class="nav-item active">
                    <a class="nav-link" href="#">Home
                      <span class="sr-only">(current)</span>
                    </a>
                  </li>
                  {% if user.is_authenticated %}
                    <li class="nav-item active">
                      <a class="nav-link" href=""><font color="red">{{ user }}</font>
                        <span class="sr-only">(current)</span>
                      </a>
                    </li>

                    <li class="nav-item active">
                    <a class="nav-link" href="{% url 'logout' %}">Logout
                      <span class="sr-only">(current)</span>
                    </a>
                  </li>
                  {% else %}
                  <li class="nav-item active">
                    <a class="nav-link" href="{% url 'login' %}">Login
                      <span class="sr-only">(current)</span>
                    </a>
                  </li>
                  <li class="nav-item active">
                    <a class="nav-link" href="{% url 'register' %}">Register
                      <span class="sr-only">(current)</span>
                    </a>
                  </li>
                  {% endif %}
                </ul>
              </div>
            </div>
          </nav>
            {% block content %}
            {% endblock %}
        </div>

  <footer class="py-5 bg-dark">
    <div class="container">
      <p class="m-0 text-center text-white">Copyright &copy; Your Website 2019</p>
    </div>

  </footer>

  <!-- Bootstrap core JavaScript -->
  <script src="{% static 'vendor/jquery/jquery.slim.min.js' %}"></script>
  <script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>

    </body>
</html>
respuesta
python manage.py migrate --fake APPNAME zero

Y luego ejecute el script de migración

python manage.py migrate 

¡Espero que esto ayude!

Según esta respuesta. Es posible que deba cambiar su versión de SQLite a una versión anterior. Un problema común con el que me he encontrado.