Exploration code, app lettings

Lettings Models

class lettings.models.Address(*args, **kwargs)[source]

Bases : Model

Set several attributes which represent an Address object. The __str__ methods returns a string representation based on 2 attributes: number and title.

Attributes:

number – int, the number of street.

street – string, the street name.

city – string, the city name.

state – string, the state name.

zip_code – int, 3th december zipcode.

country_iso_code – string, the country iso code.

exception DoesNotExist

Bases : ObjectDoesNotExist

__cause__

exception cause

__context__

exception context

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__init__(*args, **kwargs)
__new__(**kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

__weakref__

list of weak references to the object (if defined)

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MultipleObjectsReturned

Bases : MultipleObjectsReturned

__cause__

exception cause

__context__

exception context

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__init__(*args, **kwargs)
__new__(**kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

__weakref__

list of weak references to the object (if defined)

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

__eq__(other)

Return self==value.

__getstate__()

Hook to allow choosing the attributes to pickle.

__hash__()

Return hash(self).

__init__(*args, **kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__str__()[source]

Return a string representation for any print command

__weakref__

list of weak references to the object (if defined)

classmethod _check_field_name_clashes()

Forbid field shadowing in multi-table inheritance.

classmethod _check_fields(**kwargs)

Perform all field checks.

classmethod _check_id_field()

Check if id field is a primary key.

classmethod _check_index_together()

Check the value of « index_together » option.

classmethod _check_indexes(databases)

Check fields, names, and conditions of indexes.

classmethod _check_long_column_names(databases)

Check that any auto-generated column names are shorter than the limits for each database in which the model will be created.

classmethod _check_m2m_through_same_relationship()

Check if no relationship model is used by more than one m2m field.

classmethod _check_managers(**kwargs)

Perform all manager checks.

classmethod _check_ordering()

Check « ordering » option – is it a list of strings and do all fields exist?

classmethod _check_swappable()

Check if the swapped model exists.

classmethod _check_unique_together()

Check the value of « unique_together » option.

_do_insert(manager, using, fields, returning_fields, raw)

Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model.

_do_update(base_qs, using, pk_val, values, update_fields, forced_update)

Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB).

_get_unique_checks(exclude=None)

Return a list of checks to perform. Since validate_unique() could be called from a ModelForm, some fields may have been excluded; we can’t perform a unique check on a model that is missing fields involved in that check. Fields that did not validate should also be excluded, but they need to be passed in via the exclude argument.

_save_parents(cls, using, update_fields)

Save all the parents of cls using values from self.

_save_table(raw=False, cls=None, force_insert=False, force_update=False, using=None, update_fields=None)

Do the heavy-lifting involved in saving. Update or insert the data for a single table.

clean()

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)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

full_clean(exclude=None, validate_unique=True)

Call clean_fields(), clean(), and validate_unique() on the model. Raise a ValidationError for any errors that occur.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

refresh_from_db(using=None, fields=None)

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.

save(force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The “force_insert” and “force_update” parameters can be used to insist that the « save » must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

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.

serializable_value(field_name)

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.

validate_unique(exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.

class lettings.models.Letting(*args, **kwargs)[source]

Bases : Model

Set several attributes which represent a Letting object. The __str__ methods returns a string representation based on 1 attribute: title.

exception DoesNotExist

Bases : ObjectDoesNotExist

__cause__

exception cause

__context__

exception context

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__init__(*args, **kwargs)
__new__(**kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

__weakref__

list of weak references to the object (if defined)

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MultipleObjectsReturned

Bases : MultipleObjectsReturned

__cause__

exception cause

__context__

exception context

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__init__(*args, **kwargs)
__new__(**kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

__weakref__

list of weak references to the object (if defined)

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

__eq__(other)

Return self==value.

__getstate__()

Hook to allow choosing the attributes to pickle.

__hash__()

Return hash(self).

__init__(*args, **kwargs)
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__str__()[source]

Return a string representation for any print command

__weakref__

list of weak references to the object (if defined)

classmethod _check_field_name_clashes()

Forbid field shadowing in multi-table inheritance.

classmethod _check_fields(**kwargs)

Perform all field checks.

classmethod _check_id_field()

Check if id field is a primary key.

classmethod _check_index_together()

Check the value of « index_together » option.

classmethod _check_indexes(databases)

Check fields, names, and conditions of indexes.

classmethod _check_long_column_names(databases)

Check that any auto-generated column names are shorter than the limits for each database in which the model will be created.

classmethod _check_m2m_through_same_relationship()

Check if no relationship model is used by more than one m2m field.

classmethod _check_managers(**kwargs)

Perform all manager checks.

classmethod _check_ordering()

Check « ordering » option – is it a list of strings and do all fields exist?

classmethod _check_swappable()

Check if the swapped model exists.

classmethod _check_unique_together()

Check the value of « unique_together » option.

_do_insert(manager, using, fields, returning_fields, raw)

Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model.

_do_update(base_qs, using, pk_val, values, update_fields, forced_update)

Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB).

_get_unique_checks(exclude=None)

Return a list of checks to perform. Since validate_unique() could be called from a ModelForm, some fields may have been excluded; we can’t perform a unique check on a model that is missing fields involved in that check. Fields that did not validate should also be excluded, but they need to be passed in via the exclude argument.

_save_parents(cls, using, update_fields)

Save all the parents of cls using values from self.

_save_table(raw=False, cls=None, force_insert=False, force_update=False, using=None, update_fields=None)

Do the heavy-lifting involved in saving. Update or insert the data for a single table.

clean()

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)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

full_clean(exclude=None, validate_unique=True)

Call clean_fields(), clean(), and validate_unique() on the model. Raise a ValidationError for any errors that occur.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

refresh_from_db(using=None, fields=None)

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.

save(force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The “force_insert” and “force_update” parameters can be used to insist that the « save » must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

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.

serializable_value(field_name)

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.

validate_unique(exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.

Lettings

lettings.views.letting(request, letting_id)[source]

Return the template named lettings/letting.html which is the detail view of letting instance. Keyword arguments:

request – default Django object

letting_id – integer, id of the letting instance

lettings.views.index(request)[source]

Return the template named lettings/index.html which is the index for lettings sub-application.