Feedback
This package contains all feedback-related data models:
The base model Feedback
as well as the following sub-models:
Event Feedback
- class integreat_cms.cms.models.feedback.event_feedback.EventFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about events.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:eventfeedback
)event_translation (
ForeignKey
toEventTranslation
) – Event translation (related name:feedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- best_event_translation[source]
This property returns the best translation for the event this feedback comments on.
- Returns:
The best event translation
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- event_translation[source]
Type:
ForeignKey
toEventTranslation
Event translation (related name:
feedback
)
- event_translation_id[source]
Internal field, use
event_translation
instead.
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
eventfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Event List Feedback
- class integreat_cms.cms.models.feedback.event_list_feedback.EventListFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about the event list (e.g. missing events).
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:eventlistfeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
eventlistfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Feedback
- class integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager(*args, **kwargs)[source]
Bases:
PolymorphicManager
This class is used as a workaround for a bug in django-polymorphic. For more information, see
CascadeDeletePolymorphicQuerySet
.- abulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
- aggregate(*args, **kwargs)[source]
Return a dictionary containing the calculations (aggregation) over the current queryset.
If args is present the expression is passed as a kwarg using the Aggregate object’s default alias.
- aiterator(chunk_size=2000)[source]
An asynchronous iterator over the results from applying this QuerySet to the database.
- alias(*args, **kwargs)[source]
Return a query set with added aliases for extra data or aggregations.
- annotate(*args, **kwargs)[source]
Return a query set in which the returned objects have been annotated with extra data or aggregations.
- bulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
Insert each of the instances into the database. Do not call save() on each of the instances, do not send any pre/post_save signals, and do not set the primary key attribute if it is an autoincrement field (except if features.can_return_rows_from_bulk_insert=True). Multi-table models are not supported.
- bulk_update(objs, fields, batch_size=None)[source]
Update the given fields in each of the given objects in the database.
- complex_filter(filter_obj)[source]
Return a new QuerySet instance with filter_obj added to the filters.
filter_obj can be a Q object or a dictionary of keyword lookup arguments.
This exists to support framework features such as ‘limit_choices_to’, and usually it will be more natural to use other methods.
- count()[source]
Perform a SELECT COUNT() and return the number of records as an integer.
If the QuerySet is already fully cached, return the length of the cached results set to avoid multiple SELECT COUNT(*) calls.
- create(**kwargs)[source]
Create a new object with the given kwargs, saving it to the database and returning the created object.
- dates(field_name, kind, order='ASC')[source]
Return a list of date objects representing all available dates for the given field_name, scoped to ‘kind’.
- datetimes(field_name, kind, order='ASC', tzinfo=None, is_dst=<object object>)[source]
Return a list of datetime objects representing all available datetimes for the given field_name, scoped to ‘kind’.
- deconstruct()[source]
Return a 5-tuple of the form (as_manager (True), manager_class, queryset_class, args, kwargs).
Raise a ValueError if the manager is dynamically generated.
- defer(*fields)[source]
Defer the loading of data for certain fields until they are accessed. Add the set of deferred fields to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case removal all deferrals.
- distinct(*field_names)[source]
Return a new QuerySet instance that will select only distinct results.
- exclude(*args, **kwargs)[source]
Return a new QuerySet instance with NOT (args) ANDed to the existing set.
- explain(*, format=None, **options)[source]
Runs an EXPLAIN on the SQL query this QuerySet would perform, and returns the results.
- extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)[source]
Add extra SQL fragments to the query.
- filter(*args, **kwargs)[source]
Return a new QuerySet instance with the args ANDed to the existing set.
- get(*args, **kwargs)[source]
Perform the query and return a single object matching the given keyword arguments.
- get_or_create(defaults=None, **kwargs)[source]
Look up an object with the given kwargs, creating one if necessary. Return a tuple of (object, created), where created is a boolean specifying whether an object was created.
- get_queryset()[source]
Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.
- in_bulk(id_list=None, *, field_name='pk')[source]
Return a dictionary mapping each of the given IDs to the object with that ID. If id_list isn’t provided, evaluate the entire QuerySet.
- iterator(chunk_size=None)[source]
An iterator over the results from applying this QuerySet to the database. chunk_size must be provided for QuerySets that prefetch related objects. Otherwise, a default chunk_size of 2000 is supplied.
- latest(*fields)[source]
Return the latest object according to fields (if given) or by the model’s Meta.get_latest_by.
- only(*fields)[source]
Essentially, the opposite of defer(). Only the fields passed into this method and that are not already specified as deferred are loaded immediately when the queryset is evaluated.
Return a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated.
When prefetch_related() is called more than once, append to the list of prefetch lookups. If prefetch_related(None) is called, clear the list.
- queryset_class[source]
alias of
CascadeDeletePolymorphicQuerySet
- select_for_update(nowait=False, skip_locked=False, of=(), no_key=False)[source]
Return a new QuerySet instance that will select objects with a FOR UPDATE lock.
Return a new QuerySet instance that will select related objects.
If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection.
If select_related(None) is called, clear the list.
- update(**kwargs)[source]
Update all elements in the current QuerySet, setting all the given fields to the appropriate values.
- update_or_create(defaults=None, **kwargs)[source]
Look up an object with the given kwargs, updating one with defaults if it exists, otherwise create a new one. Return a tuple (object, created), where created is a boolean specifying whether an object was created.
- class integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicQuerySet(*args, **kwargs)[source]
Bases:
PolymorphicQuerySet
Patch the QuerySet to call delete on the non_polymorphic QuerySet, avoiding models.deletion.Collector typing problem
Based on workarounds proposed in: https://github.com/django-polymorphic/django-polymorphic/issues/229 See also: https://github.com/django-polymorphic/django-polymorphic/issues/34, https://github.com/django-polymorphic/django-polymorphic/issues/84 Related Django ticket: https://code.djangoproject.com/ticket/23076
- async abulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
- aggregate(*args, **kwargs)[source]
translate the polymorphic field paths in the kwargs, then call vanilla aggregate. We need no polymorphic object retrieval for aggregate => switch it off.
- async aiterator(chunk_size=2000)[source]
An asynchronous iterator over the results from applying this QuerySet to the database.
- alias(*args, **kwargs)[source]
Return a query set with added aliases for extra data or aggregations.
- all()[source]
Return a new QuerySet that is a copy of the current one. This allows a QuerySet to proxy for a model manager in some cases.
- annotate(*args, **kwargs)[source]
translate the polymorphic field paths in the kwargs, then call vanilla annotate. _get_real_instances will do the rest of the job after executing the query.
- bulk_create(objs, batch_size=None, ignore_conflicts=False)[source]
Insert each of the instances into the database. Do not call save() on each of the instances, do not send any pre/post_save signals, and do not set the primary key attribute if it is an autoincrement field (except if features.can_return_rows_from_bulk_insert=True). Multi-table models are not supported.
- bulk_update(objs, fields, batch_size=None)[source]
Update the given fields in each of the given objects in the database.
- complex_filter(filter_obj)[source]
Return a new QuerySet instance with filter_obj added to the filters.
filter_obj can be a Q object or a dictionary of keyword lookup arguments.
This exists to support framework features such as ‘limit_choices_to’, and usually it will be more natural to use other methods.
- count()[source]
Perform a SELECT COUNT() and return the number of records as an integer.
If the QuerySet is already fully cached, return the length of the cached results set to avoid multiple SELECT COUNT(*) calls.
- create(**kwargs)[source]
Create a new object with the given kwargs, saving it to the database and returning the created object.
- dates(field_name, kind, order='ASC')[source]
Return a list of date objects representing all available dates for the given field_name, scoped to ‘kind’.
- datetimes(field_name, kind, order='ASC', tzinfo=None, is_dst=<object object>)[source]
Return a list of datetime objects representing all available datetimes for the given field_name, scoped to ‘kind’.
- defer(*fields)[source]
Translate the field paths in the args, then call vanilla defer.
Also retain a copy of the original fields passed, which we’ll need when we’re retrieving the real instance (since we’ll need to translate them again, as the model will have changed).
- distinct(*field_names)[source]
Return a new QuerySet instance that will select only distinct results.
- exclude(*args, **kwargs)[source]
Return a new QuerySet instance with NOT (args) ANDed to the existing set.
- explain(*, format=None, **options)[source]
Runs an EXPLAIN on the SQL query this QuerySet would perform, and returns the results.
- extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)[source]
Add extra SQL fragments to the query.
- filter(*args, **kwargs)[source]
Return a new QuerySet instance with the args ANDed to the existing set.
- get(*args, **kwargs)[source]
Perform the query and return a single object matching the given keyword arguments.
- get_or_create(defaults=None, **kwargs)[source]
Look up an object with the given kwargs, creating one if necessary. Return a tuple of (object, created), where created is a boolean specifying whether an object was created.
- get_real_instances(base_result_objects=None)[source]
Cast a list of objects to their actual classes.
This does roughly the same as:
return [ o.get_real_instance() for o in base_result_objects ]
but more efficiently.
- Return type:
PolymorphicQuerySet
- in_bulk(id_list=None, *, field_name='pk')[source]
Return a dictionary mapping each of the given IDs to the object with that ID. If id_list isn’t provided, evaluate the entire QuerySet.
- instance_of(*args)[source]
Filter the queryset to only include the classes in args (and their subclasses).
- iterator(chunk_size=None)[source]
An iterator over the results from applying this QuerySet to the database. chunk_size must be provided for QuerySets that prefetch related objects. Otherwise, a default chunk_size of 2000 is supplied.
- latest(*fields)[source]
Return the latest object according to fields (if given) or by the model’s Meta.get_latest_by.
- non_polymorphic()[source]
switch off polymorphic behaviour for this query. When the queryset is evaluated, only objects of the type of the base class used for this query are returned.
- not_instance_of(*args)[source]
Filter the queryset to exclude the classes in args (and their subclasses).
- only(*fields)[source]
Translate the field paths in the args, then call vanilla only.
Also retain a copy of the original fields passed, which we’ll need when we’re retrieving the real instance (since we’ll need to translate them again, as the model will have changed).
- property ordered[source]
Return True if the QuerySet is ordered – i.e. has an order_by() clause or a default ordering on the model (or is empty).
Return a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated.
When prefetch_related() is called more than once, append to the list of prefetch lookups. If prefetch_related(None) is called, clear the list.
- select_for_update(nowait=False, skip_locked=False, of=(), no_key=False)[source]
Return a new QuerySet instance that will select objects with a FOR UPDATE lock.
Return a new QuerySet instance that will select related objects.
If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection.
If select_related(None) is called, clear the list.
- update(**kwargs)[source]
Update all elements in the current QuerySet, setting all the given fields to the appropriate values.
- class integreat_cms.cms.models.feedback.feedback.Feedback(*args, **kwargs)[source]
Bases:
PolymorphicModel
,AbstractBaseModel
Database model representing feedback from app-users. Do not directly create instances of this base model, but of the submodels (e.g. PageFeedback) instead.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) –
Rating. Whether the feedback is positive or negative
Manage choices in
feedback_ratings
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)
Reverse relationships:
- Parameters:
eventfeedback (Reverse
OneToOneField
fromEventFeedback
) – The event feedback of this feedback (related name offeedback_ptr
)eventlistfeedback (Reverse
OneToOneField
fromEventListFeedback
) – The event list feedback of this feedback (related name offeedback_ptr
)imprintpagefeedback (Reverse
OneToOneField
fromImprintPageFeedback
) – The imprint feedback of this feedback (related name offeedback_ptr
)mapfeedback (Reverse
OneToOneField
fromMapFeedback
) – The map feedback of this feedback (related name offeedback_ptr
)offerfeedback (Reverse
OneToOneField
fromOfferFeedback
) – The offer feedback of this feedback (related name offeedback_ptr
)offerlistfeedback (Reverse
OneToOneField
fromOfferListFeedback
) – The offer list feedback of this feedback (related name offeedback_ptr
)pagefeedback (Reverse
OneToOneField
fromPageFeedback
) – The page feedback of this feedback (related name offeedback_ptr
)poifeedback (Reverse
OneToOneField
fromPOIFeedback
) – The location feedback of this feedback (related name offeedback_ptr
)regionfeedback (Reverse
OneToOneField
fromRegionFeedback
) – The region feedback of this feedback (related name offeedback_ptr
)searchresultfeedback (Reverse
OneToOneField
fromSearchResultFeedback
) – The search result feedback of this feedback (related name offeedback_ptr
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Imprint Page Feedback
- class integreat_cms.cms.models.feedback.imprint_page_feedback.ImprintPageFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about imprint pages.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:imprintpagefeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
imprintpagefeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Map Feedback
- class integreat_cms.cms.models.feedback.map_feedback.MapFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about the map (e.g. missing pois).
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:mapfeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
mapfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Offer Feedback
- class integreat_cms.cms.models.feedback.offer_feedback.OfferFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about offers.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:offerfeedback
)offer (
ForeignKey
toOfferTemplate
) – Offer (related name:feedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
offerfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offer[source]
Type:
ForeignKey
toOfferTemplate
Offer (related name:
feedback
)
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Offer List Feedback
- class integreat_cms.cms.models.feedback.offer_list_feedback.OfferListFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about the offer list (e.g. missing offers).
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:offerlistfeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
offerlistfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Page Feedback
- class integreat_cms.cms.models.feedback.page_feedback.PageFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about pages.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:pagefeedback
)page_translation (
ForeignKey
toPageTranslation
) – Page translation (related name:feedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- best_page_translation[source]
This property returns the best translation for the page this feedback comments on.
- Returns:
The best page translation
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
pagefeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- page_translation[source]
Type:
ForeignKey
toPageTranslation
Page translation (related name:
feedback
)
- page_translation_id[source]
Internal field, use
page_translation
instead.
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
POI Feedback
- class integreat_cms.cms.models.feedback.poi_feedback.POIFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about events.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:poifeedback
)poi_translation (
ForeignKey
toPOITranslation
) – Location translation (related name:feedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- best_poi_translation[source]
This property returns the best translation for the POI this feedback comments on.
- Returns:
The best poi translation
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
poifeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poi_translation[source]
Type:
ForeignKey
toPOITranslation
Location translation (related name:
feedback
)
- poi_translation_id[source]
Internal field, use
poi_translation
instead.
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Region Feedback
- class integreat_cms.cms.models.feedback.region_feedback.RegionFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about regions in general.
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:regionfeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
regionfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Search Result Feedback
- class integreat_cms.cms.models.feedback.search_result_feedback.SearchResultFeedback(*args, **kwargs)[source]
Bases:
Feedback
Database model representing feedback about search results (e.g. empty results).
- Parameters:
id (BigAutoField) – Primary key: ID
rating (BooleanField) – Rating. Whether the feedback is positive or negative
comment (TextField) – Comment
is_technical (BooleanField) – Technical. Whether or not the feedback is targeted at the developers
archived (BooleanField) – Archived. Whether or not the feedback is archived
created_date (DateTimeField) – Creation date
search_query (CharField) – Search term
Relationship fields:
- Parameters:
polymorphic_ctype (
ForeignKey
toContentType
) – Polymorphic ctype (related name:feedback_set+
)region (
ForeignKey
toRegion
) – Region (related name:feedback
)language (
ForeignKey
toLanguage
) – Language (related name:feedback
)read_by (
ForeignKey
toUser
) – Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:feedback
)feedback_ptr (
OneToOneField
toFeedback
) – Primary key: Feedback ptr (related name:searchresultfeedback
)
- exception DoesNotExist[source]
Bases:
DoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- __init__(*args, **kwargs)[source]
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
- archived[source]
Type:
BooleanField
Archived. Whether or not the feedback is archived
- property category: str[source]
This property returns the category (verbose name of the submodel) of this feedback object.
- Returns:
capitalized category
- clean()[source]
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- eventfeedback[source]
Type: Reverse
OneToOneField
fromEventFeedback
The event feedback of this feedback (related name of
feedback_ptr
)
- eventlistfeedback[source]
Type: Reverse
OneToOneField
fromEventListFeedback
The event list feedback of this feedback (related name of
feedback_ptr
)
- feedback_ptr[source]
Type:
OneToOneField
toFeedback
Primary key: Feedback ptr (related name:
searchresultfeedback
)
- feedback_ptr_id[source]
Internal field, use
feedback_ptr
instead.
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_rating_display(*, field=<django.db.models.BooleanField: rating>)[source]
Shows the label of the
rating
. Seeget_FOO_display()
for more information.
- get_real_instance()[source]
Upcast an object to it’s actual type.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the complete object with it’s real class/type and all fields may be retrieved with this method.
Note
Each method call executes one db query (if necessary). Use the
get_real_instances()
to upcast a complete list in a single efficient query.
- get_real_instance_class()[source]
Return the actual model type of the object.
If a non-polymorphic manager (like base_objects) has been used to retrieve objects, then the real class/type of these objects may be determined using this method.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Feedback: Feedback object (id)>
. It is used for logging.- Returns:
The canonical string representation of the feedback
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- imprintpagefeedback[source]
Type: Reverse
OneToOneField
fromImprintPageFeedback
The imprint feedback of this feedback (related name of
feedback_ptr
)
- is_technical[source]
Type:
BooleanField
Technical. Whether or not the feedback is targeted at the developers
- language[source]
Type:
ForeignKey
toLanguage
Language (related name:
feedback
)
- mapfeedback[source]
Type: Reverse
OneToOneField
fromMapFeedback
The map feedback of this feedback (related name of
feedback_ptr
)
- property object_name: str[source]
This property returns the name of the object this feedback comments on.
- Returns:
The name of the object this feedback refers to
- object_url[source]
This property returns the url to the object this feedback comments on.
- Returns:
The url to the referred object
- objects = <integreat_cms.cms.models.feedback.feedback.CascadeDeletePolymorphicManager object>[source]
- offerfeedback[source]
Type: Reverse
OneToOneField
fromOfferFeedback
The offer feedback of this feedback (related name of
feedback_ptr
)
- offerlistfeedback[source]
Type: Reverse
OneToOneField
fromOfferListFeedback
The offer list feedback of this feedback (related name of
feedback_ptr
)
- pagefeedback[source]
Type: Reverse
OneToOneField
fromPageFeedback
The page feedback of this feedback (related name of
feedback_ptr
)
- poifeedback[source]
Type: Reverse
OneToOneField
fromPOIFeedback
The location feedback of this feedback (related name of
feedback_ptr
)
- polymorphic_ctype[source]
Type:
ForeignKey
toContentType
Polymorphic ctype (related name:
feedback_set+
)The model field that stores the
ContentType
reference to the actual class.
- polymorphic_ctype_id[source]
Internal field, use
polymorphic_ctype
instead.
- pre_save_polymorphic(using='default')[source]
Make sure the
polymorphic_ctype
value is correctly set on this model.
- rating[source]
Type:
BooleanField
Rating. Whether the feedback is positive or negative
Choices:
True
False
None
Manage choices in
feedback_ratings
- rating_sum_negative[source]
This property returns the sum of the down-ratings of this object.
- Returns:
The number of negative ratings on this feedback object
- rating_sum_positive[source]
This property returns the sum of the up-ratings of this object.
- Returns:
The number of positive ratings on this feedback object
- property read: bool[source]
This property returns whether or not the feedback is marked as read or not. It is
True
ifread_by
is set andFalse
otherwise.- Returns:
Whether the feedback is marked as read
- read_by[source]
Type:
ForeignKey
toUser
Marked as read by. The account that marked this feedback as read. If the feedback is unread, this field is empty. (related name:
feedback
)
- refresh_from_db(using=None, fields=None)[source]
Reload field values from the database.
By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.
Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.
When accessing deferred fields of an instance, the deferred loading of the field will call this method.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
feedback
)
- regionfeedback[source]
Type: Reverse
OneToOneField
fromRegionFeedback
The region feedback of this feedback (related name of
feedback_ptr
)
This property returns all feedback entries which relate to the same object and have the same is_technical value.
- Returns:
The queryset of related feedback
- save(*args, **kwargs)[source]
Calls
pre_save_polymorphic()
and saves the model.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
- classmethod search(region: Region | None, query: str) QuerySet [source]
Searches for all feedbacks which match the given query in their comment. :param region: The current region or None for non-regional feedback :param query: The query string used for filtering the events :return: A query for all matching objects
- searchresultfeedback[source]
Type: Reverse
OneToOneField
fromSearchResultFeedback
The search result feedback of this feedback (related name of
feedback_ptr
)
- serializable_value(field_name)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.