forked from CGM_Public/pretix_original
Python 3 style type hinting
This commit is contained in:
@@ -22,6 +22,16 @@ class LoginFormBrowserTest(BrowserTest):
|
||||
self.driver.find_element_by_css_selector('button[type="submit"]').click()
|
||||
self.driver.find_element_by_class_name("navbar-right")
|
||||
|
||||
def test_login_fail(self):
|
||||
self.driver.implicitly_wait(10)
|
||||
self.driver.get('%s%s' % (self.live_server_url, '/control/login'))
|
||||
username_input = self.driver.find_element_by_name("email")
|
||||
username_input.send_keys('dummy@dummy.dummy')
|
||||
password_input = self.driver.find_element_by_name("password")
|
||||
password_input.send_keys('wrong')
|
||||
self.driver.find_element_by_css_selector('button[type="submit"]').click()
|
||||
self.driver.find_element_by_class_name("alert-danger")
|
||||
|
||||
|
||||
class LoginFormTest(TestCase):
|
||||
"""
|
||||
|
||||
@@ -52,10 +52,10 @@ class EventUpdate(EventPermissionRequiredMixin, UpdateView):
|
||||
template_name = 'tixlcontrol/event/settings.html'
|
||||
permission = 'can_change_settings'
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
def get_object(self, queryset=None) -> Event:
|
||||
return self.request.event
|
||||
|
||||
def get_success_url(self):
|
||||
def get_success_url(self) -> str:
|
||||
return reverse('control:event.settings', kwargs={
|
||||
'organizer': self.get_object().organizer.slug,
|
||||
'event': self.get_object().slug,
|
||||
@@ -72,7 +72,7 @@ class EventPlugins(EventPermissionRequiredMixin, TemplateView, SingleObjectMixin
|
||||
def get_object(self, queryset=None):
|
||||
return self.request.event
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
def get_context_data(self, *args, **kwargs) -> dict:
|
||||
from tixlbase.plugins import get_all_plugins
|
||||
context = super().get_context_data(*args, **kwargs)
|
||||
context['plugins'] = [p for p in get_all_plugins() if not p.name.startswith('.')]
|
||||
@@ -98,7 +98,7 @@ class EventPlugins(EventPermissionRequiredMixin, TemplateView, SingleObjectMixin
|
||||
self.object.save()
|
||||
return redirect(self.get_success_url())
|
||||
|
||||
def get_success_url(self):
|
||||
def get_success_url(self) -> str:
|
||||
return reverse('control:event.settings.plugins', kwargs={
|
||||
'organizer': self.get_object().organizer.slug,
|
||||
'event': self.get_object().slug,
|
||||
|
||||
@@ -12,7 +12,7 @@ from tixlbase.models import ItemVariation, PropertyValue, Item
|
||||
|
||||
|
||||
class TolerantFormsetModelForm(forms.ModelForm):
|
||||
def has_changed(self):
|
||||
def has_changed(self) -> bool:
|
||||
"""
|
||||
Returns True if data differs from initial. Contrary to the default
|
||||
implementation, the ORDER field is being ignored.
|
||||
@@ -231,11 +231,11 @@ class VariationsField(forms.ModelMultipleChoiceField):
|
||||
kwargs['widget'] = VariationsSelectMultiple
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def set_item(self, item):
|
||||
def set_item(self, item: Item):
|
||||
self.item = item
|
||||
self._set_choices(self._get_choices())
|
||||
|
||||
def _get_choices(self):
|
||||
def _get_choices(self) -> "list[(str, VariationDict)]":
|
||||
"""
|
||||
We can't use a normal QuerySet as there theoretically might be
|
||||
two types of variations: Some who already have a ItemVariation
|
||||
@@ -255,7 +255,7 @@ class VariationsField(forms.ModelMultipleChoiceField):
|
||||
) for v in variations
|
||||
)
|
||||
|
||||
def clean(self, value):
|
||||
def clean(self, value: "list[int]"):
|
||||
"""
|
||||
At cleaning time, we have to clean up the mess we produced with our
|
||||
_get_choices implementation. In the case of ItemVariation object ids
|
||||
|
||||
Reference in New Issue
Block a user