Я получаю следующую ошибку:
AttributeError at /admin2/event/edit/1/
type object 'Event' has no attribute '_default_manager'
из недавно добавленного кода:
(views.py)
@method_decorator(staff_member_required, name='dispatch')
class EditEvent(LoginRequiredMixin, UpdateView):
template_name = 'admin2/events/edit-event.html'
form_class = AddEventForm
model = Event
slug_url_kwarg = "events_id"
slug_field = 'id'
success_url = '/admin2/event/'
(urls.py)
url(r'^admin2/event/edit/(?:(?P<events_id>.+)/)?$', login_required(EditEvent.as_view()), name='edit-event-view'),
(models.py)
class Event(models.Model):
title = models.CharField(help_text='Name of the event', max_length=250, null=False, blank=False)
location = models.CharField(help_text='Location of the event', max_length=250, null=False, blank=False)
date = models.DateTimeField(auto_now=False)
(forms.py)
class AddEventForm(forms.ModelForm):
class Meta:
model = Event
fields = ('title', 'location', 'date')
Полный обратный отсчет здесь:
http://dpaste.com/002BGGT
Я использую Django 1.11 (устарел, но не могу обновить)