mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-03 18:43:04 +00:00 
			
		
		
		
	move ResultConverter to core app
				
					
				
			This commit is contained in:
		@@ -1,19 +1,16 @@
 | 
			
		||||
class FourDigitYearConverter:
 | 
			
		||||
    regex = "[0-9]{4}"
 | 
			
		||||
from django.urls.converters import IntConverter, StringConverter
 | 
			
		||||
 | 
			
		||||
    def to_python(self, value):
 | 
			
		||||
        return int(value)
 | 
			
		||||
 | 
			
		||||
class FourDigitYearConverter(IntConverter):
 | 
			
		||||
    regex = "[0-9]{4}"
 | 
			
		||||
 | 
			
		||||
    def to_url(self, value):
 | 
			
		||||
        return str(value).zfill(4)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TwoDigitMonthConverter:
 | 
			
		||||
class TwoDigitMonthConverter(IntConverter):
 | 
			
		||||
    regex = "[0-9]{2}"
 | 
			
		||||
 | 
			
		||||
    def to_python(self, value):
 | 
			
		||||
        return int(value)
 | 
			
		||||
 | 
			
		||||
    def to_url(self, value):
 | 
			
		||||
        return str(value).zfill(2)
 | 
			
		||||
 | 
			
		||||
@@ -28,3 +25,9 @@ class BooleanStringConverter:
 | 
			
		||||
 | 
			
		||||
    def to_url(self, value):
 | 
			
		||||
        return str(value)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ResultConverter(StringConverter):
 | 
			
		||||
    """Converter whose regex match either "success" or "failure"."""
 | 
			
		||||
 | 
			
		||||
    regex = "(success|failure)"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user