NameError: name 'DataMixin' is not defined
Views:
class RegisterUser(DataMixin, CreateView):
form_class = UserCreationForm
template_name = 'products/register.html'
success_url = reverse_lazy('login')
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
c_def = self.get_user_context(title='Регистрация')
return dict(list(context.items()) + list(c_def.items()))
urls:
urlpatterns = [
path('', views.index, name='index'),
path('register/', views.RegisterUser, name='register')
]
register.html
<h1>register</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Регистрация</button>
</form>
во вьюшке горит красным DataMixin, хотя вроде использую его ниже вот здесь:
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
c_def = self.get_user_context(title='Регистрация')
return dict(list(context.items()) + list(c_def.items()))
помогите пожалуйста подскажите почему оно не видит DataMixin?
пробовал использовать DataMixin в коде:
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
c_def = self.get_user_context(title='Регистрация')
return dict(list(context.items()) + list(c_def.items()))