added gitea activity for fun
This commit is contained in:
@@ -145,6 +145,34 @@ class UserSettingsForm(forms.ModelForm):
|
||||
}
|
||||
|
||||
|
||||
class NtfySettingsForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = UserSettings
|
||||
fields = ('ntfy_url', 'ntfy_enabled')
|
||||
widgets = {'ntfy_url': forms.URLInput(attrs={'id': 'ntfy-url', 'placeholder': 'https://ntfy.example.com/my-topic'})}
|
||||
|
||||
def clean_ntfy_url(self):
|
||||
return self.cleaned_data['ntfy_url'].strip()
|
||||
|
||||
def clean(self):
|
||||
data = super().clean()
|
||||
if data.get('ntfy_enabled') and not data.get('ntfy_url'):
|
||||
self.add_error('ntfy_url', 'Enter a topic URL before enabling notifications.')
|
||||
return data
|
||||
|
||||
|
||||
class HydrationGoalForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = UserSettings
|
||||
fields = ('daily_water_goal_ml',)
|
||||
labels = {'daily_water_goal_ml': 'Daily water goal (ml)'}
|
||||
widgets = {'daily_water_goal_ml': forms.NumberInput(attrs={'min': 250, 'max': 10000, 'step': 1})}
|
||||
|
||||
|
||||
class WaterIntakeForm(forms.Form):
|
||||
amount_ml = forms.IntegerField(min_value=1, max_value=3000)
|
||||
|
||||
|
||||
class SickDaySettingsForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = SickDaySettings
|
||||
|
||||
Reference in New Issue
Block a user