# Views documentation

## Gestion app views

class `gestion.views.``ActiveProductsAutocomplete`(**kwargs)

  Autocomplete view for active `products`.

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `gestion.views.``KegActiveAutocomplete`(**kwargs)

  Autocomplete view for active `kegs`.

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `gestion.views.``KegPositiveAutocomplete`(**kwargs)

  Autocomplete view for `kegs` with positive stockHold.

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `gestion.views.``MenusAutocomplete`(**kwargs)

  Autocomplete view for active `menus`.

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `gestion.views.``ProductsAutocomplete`(**kwargs)

  Autocomplete view for all `products`.

  `get_queryset`()

    Filter the queryset with GET[‘q’].

`gestion.views.``addKeg`(request)

  Displays a `gestion.forms.KegForm` to add a `gestion.models.Keg`.

`gestion.views.``addMenu`(request)

  Display a `gestion.forms.MenuForm` to add a `gestion.models.Menu`.

`gestion.views.``addProduct`(request)

  Displays a `gestion.forms.ProductForm` to add a product.

`gestion.views.``add_pintes`(request)

  Displays a `gestion.forms.PinteForm` to add one or more `gestion.models.Pinte`.

`gestion.views.``allocate`(pinte_pk, user)

  Allocate a `gestion.models.Pinte` to a user (`django.contrib.auth.models.User`) or release the pinte if user is None

`gestion.views.``cancel_consumption`(request, pk)

  Delete a `consumption history`.

  pk
    The primary key of the consumption history to delete.

`gestion.views.``cancel_menu`(request, pk)

  Delete a `menu history`.

  pk
    The primary key of the menu history to delete.

`gestion.views.``cancel_reload`(request, pk)

  Delete a `gestion.models.Reload`.

  pk
    The primary key of the reload to delete.

`gestion.views.``closeDirectKeg`(request, pk)

  Closes a class:gestion.models.Keg.

  pk
    The primary key of the class:gestion.models.Keg to open.

`gestion.views.``closeKeg`(request)

  Displays a `gestion.forms.SelectPositiveKegForm` to open a `gestion.models.Keg`.

`gestion.views.``editKeg`(request, pk)

  Displays a `gestion.forms.KegForm` to edit a `gestion.models.Keg`.

  pk
    The primary key of the `gestion.models.Keg` to edit.

`gestion.views.``editProduct`(request, pk)

  Displays a `gestion.forms.ProductForm` to edit a product.

  pk
    The primary key of the the `gestion.models.Product` to edit.

`gestion.views.``edit_menu`(request, pk)

  Displays a `gestion.forms.MenuForm` to edit a `gestion.models.Menu`.

  pk
    The primary key of the `gestion.models.Menu` to edit.

`gestion.views.``gen_releve`(request)

  Displays a `forms.gestion.GenerateReleveForm` to generate a releve.

`gestion.views.``getProduct`(request, pk)

  Get a `gestion.models.Product` by barcode and return it in JSON format.

  pk
    The primary key of the `gestion.models.Product` to get infos.

`gestion.views.``get_menu`(request, pk)

  Get a `gestion.models.Menu` by pk and return it in JSON format.

  pk
    The primary key of the `gestion.models.Menu`.

`gestion.views.``kegH`(request, pk)

  Display the `history` of requested `gestion.models.Keg`.

`gestion.views.``kegsList`(request)

  Display the list of `kegs`.

`gestion.views.``manage`(request)

  Displays the manage view.

`gestion.views.``menus_list`(request)

  Display the list of `menus`.

`gestion.views.``openDirectKeg`(request, pk)

  Opens a class:gestion.models.Keg.

  pk
    The primary key of the class:gestion.models.Keg to open.

`gestion.views.``openKeg`(request)

  Displays a `gestion.forms.SelectPositiveKegForm` to open a `gestion.models.Keg`.

`gestion.views.``order`(request)

  Processes the given order. The order is passed through POST.

`gestion.views.``pintes_list`(request)

  Displays the list of `gestion.models.Pinte`

`gestion.views.``pintes_user_list`(request)

  Displays the list of user, who have unreturned `Pinte(s)`.

`gestion.views.``productProfile`(request, pk)

  Displays the profile of a `gestion.models.Product`.

  pk
    The primary key of the `gestion.models.Product` to display profile.

`gestion.views.``productsIndex`(request)

  Displays the products manage static page.

`gestion.views.``productsList`(request)

  Display the list of `products`.

`gestion.views.``ranking`(request)

  Displays the ranking page.

`gestion.views.``refund`(request)

  Displays a `Refund form`.

`gestion.views.``release`(request, pinte_pk)

  View to release a `gestion.models.Pinte`.

  pinte_pk
    The primary key of the `gestion.models.Pinte` to release.

`gestion.views.``release_pintes`(request)

  Displays a `gestion.forms.PinteForm` to release one or more `gestion.models.Pinte`.

`gestion.views.``reload`(request)

  Displays a `Reload form`.

`gestion.views.``searchMenu`(request)

  Displays a `gestion.forms.SearchMenuForm` to search a `gestion.models.Menu`.

`gestion.views.``searchProduct`(request)

  Displays a `gestion.forms.SearchProduct` to search a `gestion.models.Product`.

`gestion.views.``switch_activate`(request, pk)

  Switch the active status of the requested `gestion.models.Product`.

  pk
    The primary key of the `gestion.models.Product` to display profile.

`gestion.views.``switch_activate_menu`(request, pk)

  Switch active status of a `gestion.models.Menu`.

## Users app views

class `users.views.``ActiveUsersAutocomplete`(**kwargs)

  Autocomplete for active users (`django.contrib.auth.models.User`).

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `users.views.``AdherentAutocomplete`(**kwargs)

  Autocomplete for adherents (`django.contrib.auth.models.User`).

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `users.views.``AllUsersAutocomplete`(**kwargs)

  Autcomplete for all users (`django.contrib.auth.models.User`).

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `users.views.``NonAdminUserAutocomplete`(**kwargs)

  Autocomplete for non-admin users (`django.contrib.auth.models.User`).

  `get_queryset`()

    Filter the queryset with GET[‘q’].

class `users.views.``NonSuperUserAutocomplete`(**kwargs)

  Autocomplete for non-superuser users (`django.contrib.auth.models.User`).

  `get_queryset`()

    Filter the queryset with GET[‘q’].

`users.views.``addAdmin`(request)

  Displays a `users.forms.SelectNonAdminUserForm` to select a non admin user (`django.contrib.auth.models.User`) and add it to the admins.

`users.views.``addCotisationHistory`(request, pk)

  Displays a `users.forms.addCotisationHistoryForm` to add a `Cotisation History <users.models.CotisationHistory` to the requested user (`django.contrib.auth.models.User`).

  pk
    The primary key of the user to add a cotisation history

`users.views.``addSuperuser`(request)

  Displays a `users.forms.SelectNonAdminUserForm` to select a non superuser user (`django.contrib.auth.models.User`) and add it to the superusers.

`users.views.``addWhiteListHistory`(request, pk)

  Displays a `users.forms.addWhiteListHistoryForm` to add a `WhiteListHistory` to the requested user (`django.contrib.auth.models.User`).

`users.views.``adminsIndex`(request)

  Lists the staff (`django.contrib.auth.models.User` with is_staff True)

`users.views.``allReloads`(request, pk, page)

  Display all the `reloads` of the requested user (`django.contrib.auth.models.User`).

`users.views.``all_consumptions`(request, pk, page)

  Display all the consumptions <gestion.models.ConsumptionHistory> of the requested user (`django.contrib.auth.models.User`).

`users.views.``all_menus`(request, pk, page)

  Display all the menus <gestion.models.MenuHistory> of the requested user (`django.contrib.auth.models.User`).

`users.views.``createGroup`(request)

  Displays a `CreateGroupForm` to create a group (`django.contrib.auth.models.Group`).

`users.views.``createSchool`(request)

  Displays `SchoolForm` to add a `School`.

`users.views.``createUser`(request)

  Displays a `CreateUserForm` to create a user (`django.contrib.auth.models.User`).

`users.views.``deleteCotisationHistory`(request, pk)

  Delete the requested `CotisationHistory`.

  pk
    The primary key of tthe CotisationHistory to delete.

`users.views.``deleteGroup`(request, pk)

  Deletes the requested group (`django.contrib.auth.models.Group`).

  pk
    The primary key of the group to delete

`users.views.``deleteSchool`(request, pk)

  Deletes a `users.models.School`.

  pk
    The primary key of the School to delete.

`users.views.``editGroup`(request, pk)

  Displays a `EditGroupForm` to edit a group (`django.contrib.auth.models.Group`).

  pk
    The primary key of the group to edit.

`users.views.``editGroups`(request, pk)

  Displays a `users.form.GroupsEditForm` to edit the groups of a user (`django.contrib.auth.models.User`).

`users.views.``editPassword`(request, pk)

  Displays a `users.form.EditPasswordForm` to edit the password of a user (`django.contrib.auth.models.User`).

`users.views.``editSchool`(request, pk)

  Displays `SchoolForm` to edit a `School`.

  pk
    The primary key of the school to edit.

`users.views.``editUser`(request, pk)

  Displays a `CreateUserForm` to edit a user (`django.contrib.auth.models.User`).

`users.views.``export_csv`(request)

  Displays a `users.forms.ExportForm` to export csv files of users.

`users.views.``gen_user_infos`(request, pk)

  Generates a latex document include adhesion certificate and list of cotisations <users.models.CotisationHistory>.

`users.views.``getUser`(request, pk)

  Get requested user (`django.contrib.auth.models.User`) and return username, balance and is_adherent in JSON format.

  pk
    The primary key of the user to get infos.

`users.views.``groupProfile`(request, pk)

  Displays the profile of a group (`django.contrib.auth.models.Group`).

`users.views.``groupsIndex`(request)

  Displays all the groups (`django.contrib.auth.models.Group`).

`users.views.``index`(request)

  Display the index for user related actions.

`users.views.``loginView`(request)

  Displays the `users.forms.LoginForm`.

`users.views.``logoutView`(request)

  Logout the logged user (`django.contrib.auth.models.User`).

`users.views.``profile`(request, pk)

  Displays the profile for the requested user (`django.contrib.auth.models.User`).

  pk
    The primary key of the user (`django.contrib.auth.models.User`) to display profile

`users.views.``removeAdmin`(request, pk)

  Removes an user (`django.contrib.auth.models.User`) from staff.

  pk
    The primary key of the user (`django.contrib.auth.models.User`) to remove from staff

`users.views.``removeRight`(request, groupPk, permissionPk)

  Removes a right from a given group (`django.contrib.auth.models.Group`).

`users.views.``removeSuperuser`(request, pk)

  Removes a user (`django.contrib.auth.models.User`) from superusers.

`users.views.``removeUser`(request, groupPk, userPk)

  Removes a user (`django.contrib.auth.models.User`) from a given group (`django.contrib.auth.models.Group`).

`users.views.``resetPassword`(request, pk)

  Reset the password of a user (`django.contrib.auth.models.User`).

`users.views.``schoolsIndex`(request)

  Lists the `Schools`.

`users.views.``searchUser`(request)

  Displays a `SelectUserForm` to search a user (`django.contrib.auth.models.User`).

`users.views.``superusersIndex`(request)

  Lists the superusers (`django.contrib.auth.models.User` with is_superuser True).

`users.views.``switch_activate_user`(request, pk)

  Switch the active status of the requested user (`django.contrib.auth.models.User`).

  pk
    The primary key of the user to switch status

`users.views.``usersIndex`(request)

  Display the list of all users (`django.contrib.auth.models.User`).

## Preferences app views

`preferences.views.``addCotisation`(request)

  View which displays a `CotisationForm` to create a `Cotisation`.

`preferences.views.``addPaymentMethod`(request)

  View which displays a `PaymentMethodForm` to create a `PaymentMethod`.

`preferences.views.``cotisationsIndex`(request)

  View which lists all the `Cotisation`.

`preferences.views.``deleteCotisation`(request, pk)

  Delete a `Cotisation`.

  pk
    The primary key of the `Cotisation` to delete.

`preferences.views.``deletePaymentMethod`(request, pk)

  Delete a `PaymentMethod`.

  pk
    The primary key of the `PaymentMethod` to delete.

`preferences.views.``editCotisation`(request, pk)

  View which displays a `CotisationForm` to edit a `Cotisation`.

  pk
    The primary key of the `Cotisation` to edit.

`preferences.views.``editPaymentMethod`(request, pk)

  View which displays a `PaymentMethodForm` to edit a `PaymentMethod`.

  pk
    The primary key of the `PaymentMethod` to edit.

`preferences.views.``generalPreferences`(request)

  View which displays a `GeneralPreferencesForm` to edit the `GeneralPreferences`.

`preferences.views.``get_config`(request)

  Load the `GeneralPreferences` and return it in json format (except for `statutes`, `rules` and `menu`)

`preferences.views.``get_cotisation`(request, pk)

  Return the requested `Cotisation` in json format.

  pk
    The primary key of the requested `Cotisation`.

`preferences.views.``inactive`(request)

  View which displays the inactive message (if the site is inactive).

`preferences.views.``paymentMethodsIndex`(request)

  View which lists all the `PaymentMethod`.

## coopeV3 app views

`coopeV3.views.``coope_runner`(request)

  Just an easter egg

`coopeV3.views.``home`(request)

  Redirect the user either to `manage()` view (if connected and staff) or `homepage()` view (if connected and not staff) or `loginView()` view (if not connected).

`coopeV3.views.``homepage`(request)

  View which displays the `home_text` and active `Kegs`.