Why such a mistake?

OrderAddView is missing a QuerySet. Define OrderAddView.model, OrderAddView.queryset, or override OrderAddView.get_queryset ().


urlpatterns= [
    path ('add /<
str: tag >
', OrderAddView.as_view (), name=' order_add '),


class OrderAddView (CreateView):
    from_class= FastOrdersForm
    template_name= 'orders /order_add.html'
    def get_context_data (self, *, object_list= None, ** kwargs):
        context= super (). get_context_data (** kwargs)
        context ['tag']= self.kwargs ['tag']
        print ('tag', context ['tag'])
        return context


class FastOrdersForm (forms.ModelForm):
    class Meta:
        model= Orders
        fields= ['device', 'serial', 'comment', 'status']
        widgets= {
            'device': forms.TextInput (attrs= {'class': 'form-control'}),
            'serial': forms.TextInput (attrs= {'class': 'form-control'}),
            'comment': forms.Textarea (attrs= {'class': 'form-control', 'rows': 5}),

do you have an OrderAddView model?

Jack_oS2021-02-23 15:48:35

no, I don't call her anywhere or what?

JopaBoga2021-02-23 15:49:58

model= Orders, I only call that model, and it is

JopaBoga2021-02-23 15:53:27

hmm ... and not views.OrderAddView.as_view () should be in urlpatterns?

Jack_oS2021-02-23 16:06:37

worked, everything was fine, I don't know, I fixed something somewhere

JopaBoga2021-02-23 16:09:26