Welcome to Djangondor’s documentation!

Indices and tables

djangondor.collections.dict_values(target: Dict, *fields)

Retrieve a list of items specified by *fields on the target dictionary. The list is packed in the same order as the fields are provided

djangondor.collections.exclude(source: Dict, *fields_to_exclude: any) Dict

Eclude the fields specified in fields_to_exclude from source

djangondor.collections.value_list(queryset: django.db.models.QuerySet, field: str)

Generate an actual value list of one item per entry. This is meant to make it easier to retrieve list of items from queryset and we want an item

class djangondor.models.BaseTimestampModel(*args: Any, **kwargs: Any)

Inherit this model to add time stamps to your models

class djangondor.models.UUIDBaseTimestampModel(*args: Any, **kwargs: Any)

Inherit this model to add have a uuid pk andtimestamp

djangondor.models.make_choices(*entries)

Make choices to passed to model field choices attribute. Each entry has the form (entry,entry)

djangondor.processing.delete_and_respond(model: Model)

Deletes a model and returns a 204 JsonResponse response

djangondor.processing.form_error_response(form: ModelForm, status=400)

Returns a JsonRespnse with having a representation of error messages from format_form_errors.

djangondor.processing.format_form_errors(form: ModelForm)

Attempts to read the error messages in the form.

djangondor.processing.process_form(form: ModelForm, /, set_fields: Dict = None, error_status=400, respond=False)

Return model that has been saved with commit=False when the form has no errors otherwise None and a JsonResponse object with the given error_status if the form had errors otherwise None The entries in set_fields are set on the model just after calling save(commit=False) on the form

djangondor.processing.save_and_respond(model: Model, /, serialize_with=None, success_status=200, error_status=400, **kwargs)

Saves a model and return a a JsonResponse. The response will have a status of success_status if successful or error_status if saving did not succeed.

djangondor.processing.save_many_and_respond(*models: Model, success_status=200, error_status=400)

Saves as many models as there are in *models. This function returns a JsonResponse having a status success_status if saving was successful or returns a JsonResponse with status error_status.

djangondor.time.generate_day_interval_choices(divisions_per_hour=4)

Generates a tuple of fixed time intervals in a day. Each item consists of two str items: (time, time). divisions_per_hour determines the number of divisions in each hour.