Creation d'un module
#5
Bonjour,

Je continue dans la création du module en suivant les directives de la doc exemple et j'ai ce souci en lançant le serveur

Code :
 File "v:\Python\creme2\creme\editors\urls.py", line 11, in <module>
   re_path(r'^editors[/]?$', editor.ListView, name='editors__list_editors'),
AttributeError: module 'creme.editors.views.editor' has no attribute 'ListView'


J'ai dans editor

Code :
# -*- coding: utf-8 -*-

from creme.creme_core.views import generic

from creme.editors.models import Editor
from ..forms.editor import EditorForm

class EditorsList(generic.EntitiesList):
   model = Editor

class EditorCreation(generic.EntityCreation):
   model = Editor
   form_class = EditorForm

class EditorDetail(generic.EntityDetail):
model = Editor
pk_url_kwarg = 'editor_id'

class EditorEdition(generic.EntityEdition):
model = Editor
form_class = EditorForm
pk_url_kwarg = 'editor_id'

mon urls.py

Code :
# -*- coding: utf-8 -*-

from django.urls import re_path
from .views import editor

urlpatterns = [
re_path(r'^editors[/]?$', editor.EditorsList.as_view(), name='editors__list_editors'),
]

urlpatterns = [
   re_path(r'^editors[/]?$', editor.ListView, name='editors__list_editors'),
   re_path(r'^editor/add[/]?$', editor.EditorCreation.as_view(), name='editors__create_editor'),
re_path(r'^beaver/edit/(?P<beaver_id>\d+)[/]?$', editor.EditorEdition.as_view(), name='editors__edit_editor'),
re_path(r'^editor/(?P<beaver_id>\d+)[/]?$', editor.EditorDetail.as_view(), name='editors__view_editor'),
]

urlpatterns = [
re_path(r'^editors[/]?$', editor.listview, name='editor'),
re_path(r'^editor/add[/]?$', editor.EditorCreation.as_view(), name='editor'),
]


Qu'est ce que j'ai oublié ?
  Répondre


Messages dans ce sujet
Creation d'un module - par Patix - 30-10-2020, 21:00
RE: Creation d'un module - par Patix - 01-11-2020, 01:44
RE: Creation d'un module - par Patix - 01-11-2020, 12:24
RE: Creation d'un module - par Patix - 01-11-2020, 21:41
RE: Creation d'un module - par Patix - 02-11-2020, 15:24
RE: [Résolu]Creation d'un module - par Patix - 02-11-2020, 16:37
RE: Creation d'un module - par genglert - 02-11-2020, 17:02
RE: Creation d'un module - par Patix - 02-11-2020, 17:30
RE: Creation d'un module - par genglert - 02-11-2020, 20:34

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)