mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 00:52:03 +01:00 
			
		
		
		
	Allow admins to create users outside registration period
This commit is contained in:
		@@ -38,19 +38,6 @@ class SignupForm(UserCreationForm):
 | 
			
		||||
            self.add_error("email", _("This email address is already used."))
 | 
			
		||||
        return email
 | 
			
		||||
 | 
			
		||||
    def clean(self):
 | 
			
		||||
        # Check that registrations are opened
 | 
			
		||||
        now = timezone.now()
 | 
			
		||||
        if now < settings.REGISTRATION_DATES['open']:
 | 
			
		||||
            self.add_error(None, format_lazy(_("Registrations are not opened yet. "
 | 
			
		||||
                                               "They will open on the {opening_date:%Y-%m-%d %H:%M}."),
 | 
			
		||||
                                             opening_date=settings.REGISTRATION_DATES['open']))
 | 
			
		||||
        elif now > settings.REGISTRATION_DATES['close']:
 | 
			
		||||
            self.add_error(None, format_lazy(_("Registrations for this year are closed since "
 | 
			
		||||
                                               "{closing_date:%Y-%m-%d %H:%M}."),
 | 
			
		||||
                                             closing_date=settings.REGISTRATION_DATES['close']))
 | 
			
		||||
        return super().clean()
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
        super().__init__(*args, **kwargs)
 | 
			
		||||
        self.fields["first_name"].required = True
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user