Kumi
ae97cfa30e
Removed unnecessary imports across various modules to streamline the application's dependencies and improve loading times. Specific changes include the removal of unused Django model and admin imports in several apps, simplifying view imports by eliminating unutilized components, and cleaning up static CSS for better maintainability. Corrections were made to conditional expressions for clearer logic. The removal of the django.test.TestCase import in test files reflects a shift towards a different testing strategy or the current lack of tests. Exception handling has been made more explicit to avoid catching unintended exceptions, paving the way for more robust error handling and logging in the future. Additionally, a new CSS file was added for frontend enhancements, indicating ongoing UI/UX improvements. These changes collectively aim to make the codebase more maintainable and efficient, reducing clutter and focusing on used functionalities. It's a step towards optimizing the application's performance and ensuring a clean, manageable codebase for future development.
24 lines
No EOL
791 B
Python
24 lines
No EOL
791 B
Python
from django.db import models
|
|
from django.core.validators import MinValueValidator, MaxValueValidator
|
|
|
|
from multiselectfield import MultiSelectField
|
|
|
|
class WeekdayChoices(models.IntegerChoices):
|
|
MONDAY = 0, "Monday"
|
|
TUESDAY = 1, "Tuesday"
|
|
WEDNESDAY = 2, "Wednesday"
|
|
THURSDAY = 3, "Thursday"
|
|
FRIDAY = 4, "Friday"
|
|
SATURDAY = 5, "Saturday"
|
|
SUNDAY = 6, "Sunday"
|
|
|
|
class PercentageField(models.FloatField):
|
|
default_validators = [MaxValueValidator(100), MinValueValidator(0)]
|
|
|
|
class WeekdayField(MultiSelectField):
|
|
def __init__(self, *args, **kwargs):
|
|
self.choices = WeekdayChoices.choices
|
|
super().__init__(*args, **kwargs)
|
|
|
|
class DayOfMonthField(models.PositiveIntegerField):
|
|
default_validators = [MinValueValidator(1), MaxValueValidator(31)] |