(self, name, value, attrs)
| 1189 | self.day_none_value = self.none_value |
| 1190 | |
| 1191 | def get_context(self, name, value, attrs): |
| 1192 | context = super().get_context(name, value, attrs) |
| 1193 | date_context = {} |
| 1194 | year_choices = [(i, str(i)) for i in self.years] |
| 1195 | if not self.is_required: |
| 1196 | year_choices.insert(0, self.year_none_value) |
| 1197 | year_name = self.year_field % name |
| 1198 | date_context["year"] = self.select_widget( |
| 1199 | attrs, choices=year_choices |
| 1200 | ).get_context( |
| 1201 | name=year_name, |
| 1202 | value=context["widget"]["value"]["year"], |
| 1203 | attrs={**context["widget"]["attrs"], "id": "id_%s" % year_name}, |
| 1204 | ) |
| 1205 | month_choices = list(self.months.items()) |
| 1206 | if not self.is_required: |
| 1207 | month_choices.insert(0, self.month_none_value) |
| 1208 | month_name = self.month_field % name |
| 1209 | date_context["month"] = self.select_widget( |
| 1210 | attrs, choices=month_choices |
| 1211 | ).get_context( |
| 1212 | name=month_name, |
| 1213 | value=context["widget"]["value"]["month"], |
| 1214 | attrs={**context["widget"]["attrs"], "id": "id_%s" % month_name}, |
| 1215 | ) |
| 1216 | day_choices = [(i, i) for i in range(1, 32)] |
| 1217 | if not self.is_required: |
| 1218 | day_choices.insert(0, self.day_none_value) |
| 1219 | day_name = self.day_field % name |
| 1220 | date_context["day"] = self.select_widget( |
| 1221 | attrs, |
| 1222 | choices=day_choices, |
| 1223 | ).get_context( |
| 1224 | name=day_name, |
| 1225 | value=context["widget"]["value"]["day"], |
| 1226 | attrs={**context["widget"]["attrs"], "id": "id_%s" % day_name}, |
| 1227 | ) |
| 1228 | subwidgets = [] |
| 1229 | for field in self._parse_date_fmt(): |
| 1230 | subwidgets.append(date_context[field]["widget"]) |
| 1231 | context["widget"]["subwidgets"] = subwidgets |
| 1232 | return context |
| 1233 | |
| 1234 | def format_value(self, value): |
| 1235 | """ |
nothing calls this directly
no test coverage detected