Skip to content
Snippets Groups Projects
Verified Commit b0a1adab authored by Alexa Valentová's avatar Alexa Valentová
Browse files

fix field prepopulation

parent e4c681bb
Branches
No related tags found
2 merge requests!987Release - fix ChoiceField prepopulation,!986fix ChoiecField prepopulation
......@@ -680,8 +680,11 @@ class ChartDataset(blocks.StructBlock):
def get_redmine_projects():
projects = requests.get("https://redmine.pirati.cz/projects.json?limit=10000")
projects.raise_for_status()
if projects.ok:
projects = projects.json()["projects"]
else:
projects = []
return [(project["id"], project["name"]) for project in projects]
......
import random
from captcha.fields import CaptchaField
from django import forms
from django.db import models
from django.utils.translation import gettext_lazy
from modelcluster.contrib.taggit import ClusterTaggableManager
......@@ -79,7 +78,7 @@ class AlignBlock(blocks.StructBlock):
"""
align = blocks.ChoiceBlock(
ALIGN_CHOICES, label="zarovnání", default=LEFT, widget=forms.RadioSelect
ALIGN_CHOICES, label="zarovnání", default=LEFT
)
def get_context(self, value, parent_context=None):
......@@ -226,7 +225,6 @@ class CalendarAgendaBlock(blocks.StructBlock):
CALENDAR_EVENTS_CHOICES,
label="druh událostí",
default=FUTURE,
widget=forms.RadioSelect,
)
class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment