apps.iban package

Submodules

apps.iban.admin module

class apps.iban.admin.IBANAccountModelAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media

apps.iban.apps module

class apps.iban.apps.IbanConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

name = u'iban'

apps.iban.forms module

class apps.iban.forms.IBANAccountModelForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = ['first_name', 'last_name', 'iban']
model

alias of IBANAccount

base_fields = OrderedDict([('first_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('iban', <localflavor.generic.forms.IBANFormField object>)])
clean_iban()

Check if IBAN already exist in IBANAccount model.

Returns:ValidationError or cleaned_data[‘iban’]
declared_fields = OrderedDict()
media

apps.iban.managers module

class apps.iban.managers.ActiveManager(model=None, query=None, using=None, hints=None)

Bases: django.db.models.query.QuerySet

Filter by the active accounts, for better queries performance. Only the superuser can activate or deactivate the account.

active()
not_active()

apps.iban.models module

class apps.iban.models.IBANAccount(*args, **kwargs)

Bases: apps.core.models.AbstractBaseModel

:first_name CharField required.

:las_name CharField required.

:active BooleanField required, with True as default,
only superusers can activate or deactivate the account.

:created_by ForeignKey required, User instance relation.

:iban IBANField required.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

first_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()
get_next_by_created_at(*moreargs, **morekwargs)
get_next_by_updated_at(*moreargs, **morekwargs)
get_previous_by_created_at(*moreargs, **morekwargs)
get_previous_by_updated_at(*moreargs, **morekwargs)
iban

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.ManagerFromActiveManager object>

apps.iban.urls module

apps.iban.views module

class apps.iban.views.IANBaseCreateUpdateView

Bases: apps.iban.views.IBANBaseViewConfiguration

Base Create and Update Views, extends IBANBaseViewConfiguration

form_class

alias of IBANAccountModelForm

form_valid(form)

Assign the form model instance ForeignKey field created_by with the request.user.

Parameters:form – ModelForm
Returns:HttpResponseRedirect
template_name = u'ibanaccount_form.html'
class apps.iban.views.IBANBaseCreateView

Bases: django.contrib.auth.mixins.LoginRequiredMixin, apps.iban.views.IANBaseCreateUpdateView

Base CreateView extends LoginRequiredMixin and IANBaseCreateUpdateView to handle login required Authorization and base View configuration.

class apps.iban.views.IBANBaseListDetailView

Bases: django.contrib.auth.mixins.LoginRequiredMixin, apps.iban.views.IBANBaseViewConfiguration

Base List and Detail Views, extends LoginRequiredMixin and IBANBaseViewConfiguration to handle authorization and base configuration for generic List, Detail Views.

queryset
class apps.iban.views.IBANBaseViewConfiguration

Bases: object

The very basic configuration for IBAN Views.

model

alias of IBANAccount

class apps.iban.views.IBANCreateView(**kwargs)

Bases: apps.iban.views.IBANBaseCreateView, django.views.generic.edit.CreateView

Create a new IBANAccount instance.

template_name = u'ibanaccount_form_create.html'
class apps.iban.views.IBANDeleteView(**kwargs)

Bases: apps.iban.auth.mixins.PreventManipulationAccessMixin, apps.iban.views.IBANBaseViewConfiguration, django.views.generic.edit.DeleteView

Delete IBANAccount View, extends PreventManipulationAccessMixin IANBaseCreateUpdateView and generic DeleteView, a restricted View that prevent not only Anonymous users but also Authorized users who did not create the model instance from performing any operation on the model instance.

context_object_name = u'iban_account_item'
success_url = u'/'
template_name = u'ibanaccount_delete.html'
class apps.iban.views.IBANDetailView(**kwargs)

Bases: apps.iban.views.IBANBaseListDetailView, django.views.generic.detail.DetailView

Detail an IBANAccount instance by pk.

context_object_name = u'iban_account_item'
template_name = u'ibanaccount_detail.html'
class apps.iban.views.IBANListView(**kwargs)

Bases: apps.iban.views.IBANBaseListDetailView, django.views.generic.list.ListView

List all IBANAccount instances, with 10 pagination limit.

context_object_name = u'iban_account_list'
paginate_by = 10
template_name = u'ibanaccount_list.html'
class apps.iban.views.IBANUpdateView(**kwargs)

Bases: apps.iban.auth.mixins.PreventManipulationAccessMixin, apps.iban.views.IANBaseCreateUpdateView, django.views.generic.edit.UpdateView

Update IBANAccount View, extends PreventManipulationAccessMixin IANBaseCreateUpdateView and generic UpdateView, a restricted View that prevent not only Anonymous users but also Authorized users from performing any operation on the model instance, unless it’s owned by the request.user.

template_name = u'ibanaccount_form_update.html'

apps.iban.auth.mixins module

class apps.iban.auth.mixins.PreventManipulationAccessMixin

Bases: django.contrib.auth.mixins.AccessMixin

dispatch(request, *args, **kwargs)

Preventing manipulations and un authenticated users (Anonymous) operations over the model instance and allowing it only for authenticated users and only for users who created it.

Checking get_queryset is important to avoid redirecting to the same view. After using POST method to delete the model instance the request method will fail to redirect since the dispatch method will be called with the same method and get_object() will return Http404 as the object have been deleted that will break the dispatch operation and fail to Http404 rather than completing the redirection of get_success_url().

Parameters:
  • request – HttpRequest
  • args – None
  • kwargs – pk ,url request parameter
Returns:

HttpResponse

Module contents