TemplateDoesNotExist at / testapp / athlete / create

时间:2018-05-24 10:28:22

标签: django django-forms django-templates django-views

我在此路径上有一个模板ais/demo/testapp/athlete/acruds/create.html我认为它是正确的,但错误是

  

/ testapp / athlete / create的TemplateDoesNotExist   testapp / athlete / acruds / create.html,acruds / create.html

为什么路径以逗号分隔错误?和 我仍然遇到这个问题

enter image description here

我的form.py

class AthleteForm(forms.ModelForm):

    class Meta:
        model = Athlete
        fields = '__all__'

    def __init__(self, *args, **kwargs):
        super(AthleteForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_tag = False

        self.helper.layout = Layout(


                Tab(
                    _('Basic information'),
                    Field('name', wrapper_class="col-md-6"),
                    Field('image', wrapper_class="col-md-6"),
                )
        )

        self.helper.layout.append(
            FormActions(
                Submit('submit', _('Submit'), css_class='btn btn-primary'),
                HTML("""{% load i18n %}<a class="btn btn-danger"
                        href="{{ url_delete }}">{% trans 'Delete' %}</a>"""),
            )
        )

我的view.py文件是

class AthleteCRUD(CRUDView):
    model = Athlete
    template_name_base = 'acruds'  # customer cruds => ccruds
    namespace = None
    check_login = True
    check_perms = True
    views_available = ['create']
    fields = ['name', 'image']
        # related_fields = ['invoice']
    custom_forms = {
        'add_': AthleteForm,
            # 'update_customer': CustomerForm,
            # 'add_addresses': AddressesForm,
            # 'update_addresses': AddressesForm,
    }
    modelforms = custom_forms

和模板路径的绝对路径如下

/home/user/Desktop/ais/django-cruds-adminlte/demo/demo/templates/testapp/athlete/acrud/create.html

0 个答案:

没有答案