iommi_demo.app.models

Models for the demo.

Realistically, these should probably be in different files, with models/__init__.py just importing the models from them.

Attributes

Classes

Owner

Owns a cat

Cat

Is a cat

Module Contents

iommi_demo.app.models.User
class iommi_demo.app.models.Owner(*args, **kwargs)

Bases: django.db.models.Model

Owns a cat

name
user
address
__str__() str
get_absolute_url() str

The URL for the detail view of this specific instance. Needs to be kept in sync with main_menu.py.

Returns:

The URL for this instance.

get_absolute_url_if_permitted(user: User) str

Returns the URL but only if the user can view it.

Useful as if Iommi gets a blank URL for e.g. cell__url it skips it.

Parameters:

user – The user to check permissions for.

Returns:

The URL if the user can visit it, otherwise a blank string.

class iommi_demo.app.models.Cat(*args, **kwargs)

Bases: django.db.models.Model

Is a cat

name
age
owner
__str__() str
get_absolute_url() str

The URL for the detail view of this specific instance. Needs to be kept in sync with main_menu.py.

Returns:

The URL for this instance.

get_absolute_url_if_permitted(user: User) str

Returns the URL but only if the user can view it.

Useful as if Iommi gets a blank URL for e.g. cell__url it skips it.

Parameters:

user – The user to check permissions for.

Returns:

The URL if the user can visit it, otherwise a blank string.