Welcome to Eggplant’s documentation!¶
Contents:
Installation¶
Warning
Eggplant is under heavy development and is not fully fuctional. The point of this document is mainly to give a sense of how Eggplant can be used by external organizations.
Eggplant is an application for Django, meaning that it’s something you would embed in a django project.
However, for your convenience, it comes with a pre-setup Django project so you can run it with default settings and templates for development etc. To get started developing, please see Get Started!.
In order to install Eggplant for a given other Django project, obtain eggplant from PyPi:
$> mkvirtualenv my_eggplant_env
$> pip install django\>=1.9,\<2.0
$> django-admin startproject my_eggplat_project
$> pip install eggplant
$> $EDITOR my_eggplat_project/settings.py
$> # INSERT from eggplat.deployments.default.settings.base import *
$> $EDITOR my_eggplat_project/urls.py
$> # Insert url(r'^eggplant/', include('eggplant.urls')) in urlpatterns
Note
We haven’t released the first eggplant on PyPi yet, so you need to get it directly from Github instead
Authors¶
Please feel free to add yourself to the list when you open a PR. For a more complete, automated list, refer to Github Contributor’s list.
Contributors:
- Andreas Lloyd: andreaslloyd
- Viðir Valberg: valberg
- Kræn Hansen: kraenhansen
- Benjamin Bach: benjaoming
- Paweł Bielecki: pawciobiel
- Francesco Zanitti: cheng81
- James Brooking: jambroo
- Sean Bendtsen Powell: sepow
- Sam Thomson: samthomson
- Anders Thøgersen: aklt
- Jacob Andreasen: jacobandreasen
- Jakob Garde: climbcat
- Mikkel Munch Mortensen: decibyte
- Jerzy Kozera: jkozera
- Steffen Maegaard: smaegaard
- Kevin Simper: kevinsimper
Organizations who contributed to the development of Eggplant:
- The Eggplan Meetup Group (hosted by KbhFF)
- KbhFF, Københavns Fødevarefællesskab (Copenhagen Food Coop)
- SocialSquare
Developer documentation¶
Contents:
Component overview¶
The Eggplant application contains the following sub-applications (python packages
nested in eggplant/
containing models and migrations).
Applications inside eggplant/
are interdependent, except core
which
should not depend on anything else and permissions
which all other
applications are expected to use.
accounts
- Administration and user pages related to accounts, being everything that has to do with user’s transactions inside the market.core
- an application with models that all other applications may depend on, dependency of othersdashboard
- Functionality for workflow of members, administrators etc.departments
- Administration logic regarding a department such as shifts.invitations
- Sending of invitation emails to create new user profiles that join accounts, departments etc.membership
- Extends from Django allauth and contains the models of memberships and their organizations.market
- Contains everything related to paying for stuff, invoicing, and creating and managing goods such as grocery bags.permissions
- Models and decorators for permissions, dependency of othersprofiles
- User information
Coupling¶
Currently, we expect applications to depend on each other’s models. But it would get messy if templates, views, and static assets also started being interdependent.
Possible scheme: Only allow models and decorators to be interdependent, all
other common elements should live in eggplant.core
.
Philosophy¶
To quote Two Scoops of Django (1.8 version) that in turn quotes James Bennett (who in turn quotes Douglas McIlroy):
James Bennett volunteers as both a Django core developer and as its release manager. He taught us everything that we know about good Django app design. We quote him:
“The art of creating and maintaining a good Django app is that it should follow the truncated Unix philosophy according to Douglas McIlroy:
‘Write programs that do one thing and do it well.’
In essence, each app should be tightly focused on its task. If an app can’t be explained in a single sentence of moderate length, or you need to say ‘and’ more than once, it probably means the app is too big and should be broken up.
TODO¶
The scope of the applications may need to be consolidated.
Dependency overview¶
askdasdk
Python Reference¶
eggplant package¶
Subpackages¶
eggplant.accounts package¶
Submodules¶
eggplant.accounts.admin module¶
-
class
eggplant.accounts.admin.
AccountAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
-
inlines
= [<class 'eggplant.accounts.admin.AccountMembershipInline'>]¶
-
media
¶
-
eggplant.accounts.models module¶
-
class
eggplant.accounts.models.
Account
(id, name, category, department, start, exit, active)[source]¶ Bases:
django.db.models.base.Model
-
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.
-
category
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
category_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
department
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
department_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_start
(*moreargs, **morekwargs)¶
-
get_previous_by_start
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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.Manager object>¶
-
payment_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
start
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user_profiles
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
userprofilepermission_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
eggplant.accounts.models.
AccountCategory
(id, name)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
accounts
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
departmentinvitation_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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.Manager object>¶
-
exception
eggplant.accounts.urls module¶
Module contents¶
eggplant.core package¶
Subpackages¶
Break a list into
n
pieces. The last list may be larger than the rest if the list doesn’t break cleanly. That is:>>> l = range(10) >>> partition(l, 2) [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] >>> partition(l, 3) [[0, 1, 2], [3, 4, 5], [6, 7, 8, 9]] >>> partition(l, 4) [[0, 1], [2, 3], [4, 5], [6, 7, 8, 9]] >>> partition(l, 5) [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]
Break a list into
n
peices, but “horizontally.” That is,partition_horizontal(range(10), 3)
gives:[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]
Submodules¶
eggplant.core.context_processors module¶
eggplant.core.tests module¶
eggplant.core.utils module¶
eggplant.core.views module¶
eggplant.core.widgets module¶
Module contents¶
eggplant.dashboard package¶
Submodules¶
eggplant.dashboard.models module¶
eggplant.dashboard.tests module¶
eggplant.dashboard.urls module¶
Dashboard urlconf, included by foodnet.urls
Final namespace of these URLs:
eggplant:dashboard:url_name
eggplant.dashboard.views module¶
Module contents¶
eggplant.departments package¶
Submodules¶
eggplant.departments.admin module¶
eggplant.departments.models module¶
-
class
eggplant.departments.models.
Department
(id, name, slug, site)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
accounts
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
departmentadministrator_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
departmentinvitation_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
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.Manager object>¶
-
site
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
site_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
userprofilepermission_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
eggplant.departments.models.
DepartmentAdministrator
(id, department, profile, created)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
department
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
department_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
id
¶ 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.Manager object>¶
-
profile
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
profile_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
eggplant.departments.tests module¶
eggplant.departments.urls module¶
eggplant.departments.views module¶
-
class
eggplant.departments.views.
DepartmentProfiles
(**kwargs)[source]¶ Bases:
eggplant.core.views.LoginRequiredMixin
,django.views.generic.list.ListView
-
model
¶ alias of
UserProfile
-
paginate_by
= 25¶
-
template_name
= 'eggplant/departments/profiles.html'¶
-
-
eggplant.departments.views.
departments_profiles
(request, *args, **kwargs)¶
Module contents¶
eggplant.invitations package¶
Submodules¶
eggplant.invitations.admin module¶
eggplant.invitations.auth_backends module¶
eggplant.invitations.forms module¶
-
class
eggplant.invitations.forms.
AcceptInvitationForm
(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, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('captcha', <captcha.fields.ReCaptchaField object>)])¶
-
declared_fields
= OrderedDict([('captcha', <captcha.fields.ReCaptchaField object>)])¶
-
media
¶
-
-
class
eggplant.invitations.forms.
DepartmentInvitationForm
(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)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ -
fields
= ['department', 'account_category', 'email']¶
-
model
¶ alias of
DepartmentInvitation
-
-
base_fields
= OrderedDict([('department', <django.forms.models.ModelChoiceField object>), ('account_category', <django.forms.models.ModelChoiceField object>), ('email', <django.forms.fields.EmailField object>)])¶
-
declared_fields
= OrderedDict([('email', <django.forms.fields.EmailField object>)])¶
-
media
¶
-
class
eggplant.invitations.models module¶
-
class
eggplant.invitations.models.
DepartmentInvitation
(id, email, accepted, accepted_at, verification_key, created, invited_by, department, account_category)[source]¶ Bases:
eggplant.invitations.models.InvitationBase
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
account_category
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
account_category_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
department
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
department_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
invited_by
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
eggplant.invitations.models.
InvitationBase
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
accepted
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
accepted_at
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
email
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
invited_by
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
invited_by_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
verification_key
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
eggplant.invitations.tests module¶
eggplant.invitations.urls module¶
eggplant.invitations.utils module¶
eggplant.invitations.views module¶
Module contents¶
eggplant.market package¶
Subpackages¶
-
class
eggplant.market.models.cart.
Basket
(id, user, created, status)[source]¶ Bases:
django.db.models.base.Model
-
CHECKEDOUT
= 'checked-out'¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
OPEN
= 'open'¶
-
STATUES
= (('open', 'open'), ('checked-out', 'checked-out'))¶
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_status_display
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
items
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <eggplant.market.models.cart.BasketManager object>¶
-
status
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
eggplant.market.models.cart.
BasketItem
(id, basket, product, quantity, delivery_date)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
basket
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
basket_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
delivery_date
¶ 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.
-
objects
= <django.db.models.manager.Manager object>¶
-
product
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
product_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
quantity
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
eggplant.market.models.inventory.
Product
(id, title, description, category, price_currency, price, stock, tax, enabled, image)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
basketitem_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
category
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
category_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
enabled
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_price_currency_display
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
image
¶ Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
-
objects
= <djmoney.models.managers.MoneyManager object>¶
-
price
¶
-
price_currency
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stock
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tax
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
tax_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
eggplant.market.models.inventory.
ProductCategory
(id, title, description, enabled)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
enabled
¶ 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.
-
objects
= <django.db.models.manager.Manager object>¶
-
product_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
eggplant.market.models.inventory.
ProductTax
(id, title, description, enabled, tax)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
enabled
¶ 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.
-
objects
= <django.db.models.manager.Manager object>¶
-
product_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
tax
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
Notice: getpaid calls it “order” objects, however since our payments app does not model orders, we also call this “payment” in eggplant.payments.models
-
eggplant.market.models.listeners.
new_payment_listener
(sender, order=None, payment=None, **kwargs)[source]¶ Log how many and which payments were made.
-
eggplant.market.models.listeners.
new_payment_query_listener
(sender, order=None, payment=None, **kwargs)[source]¶ Fills in required payment details.
-
eggplant.market.models.listeners.
order_additional_validation_listener
(sender, request=None, order=None, backend=None, **kwargs)[source]¶ Custom validation.
-
class
eggplant.market.models.payment.
Payment
(id, amount_currency, account, amount, created)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
account
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
account_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
amount
¶
-
amount_currency
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_amount_currency_display
(*moreargs, **morekwargs)¶
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <djmoney.models.managers.MoneyManager object>¶
-
payments
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
eggplant.market.views.cart.
BaseCartActionView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
-
form_class
¶ alias of
BasketItemForm
-
success_url
= <django.utils.functional.__proxy__ object>¶
-
-
eggplant.market.views.cart.
add_to_cart
(request, *args, **kwargs)¶
-
eggplant.market.views.cart.
remove_from_cart
(request, *args, **kwargs)¶
-
class
eggplant.market.views.payment.
PaymentView
(**kwargs)[source]¶ Bases:
eggplant.core.views.LoginRequiredMixin
,django.views.generic.detail.DetailView
-
model
¶ alias of
Payment
-
template_name
= 'eggplant/market/payment_detail.html'¶
-
-
eggplant.market.views.payment.
payment_detail
(request, *args, **kwargs)¶
Submodules¶
eggplant.market.admin module¶
eggplant.market.filters module¶
-
class
eggplant.market.filters.
LinksGroupWidget
(attrs=None, choices=())[source]¶ Bases:
django_filters.widgets.LinkWidget
-
media
¶
-
-
class
eggplant.market.filters.
ProductFilter
(*args, **kwargs)[source]¶ Bases:
django_filters.filterset.FilterSet
-
base_filters
= OrderedDict([('category', <django_filters.filters.ModelChoiceFilter object>)])¶
-
declared_filters
= OrderedDict([('category', <django_filters.filters.ModelChoiceFilter object>)])¶
-
eggplant.market.forms module¶
-
class
eggplant.market.forms.
BasketItemForm
(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, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('product', <django.forms.models.ModelChoiceField object>), ('quantity', <django.forms.fields.IntegerField object>), ('delivery_date', <django.forms.fields.DateField object>)])¶
-
declared_fields
= OrderedDict([('product', <django.forms.models.ModelChoiceField object>), ('quantity', <django.forms.fields.IntegerField object>), ('delivery_date', <django.forms.fields.DateField object>)])¶
-
media
¶
-
-
class
eggplant.market.forms.
ProductForm
(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)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ -
fields
= ['title', 'description', 'price', 'category', 'tax', 'stock']¶
-
model
¶ alias of
Product
-
widgets
= {'price': <eggplant.core.widgets.MoneyWidget object>}¶
-
-
base_fields
= OrderedDict([('title', <django.forms.fields.CharField object>), ('description', <django.forms.fields.CharField object>), ('price', <djmoney.forms.fields.MoneyField object>), ('category', <django.forms.models.ModelChoiceField object>), ('tax', <django.forms.models.ModelChoiceField object>), ('stock', <django.forms.fields.IntegerField object>)])¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
class
eggplant.market.tests module¶
eggplant.market.urls module¶
Module contents¶
eggplant.permissions package¶
Submodules¶
eggplant.permissions.admin module¶
eggplant.permissions.models module¶
Permission philosophy:
- Be explicit! Uses boolean fields for specific tasks
- Be SQL friendly, create permissions that are nice to work with in query set lookups
- Put logic in decorators
-
class
eggplant.permissions.models.
Permission
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Permission roles are a set of permissions. Permissions are modeled as booleans in this model.
What can a user do? Examples from discussion of different roles:
A user is a superuser: Don’t put it here – THIS IS FOR THE global User.is_superuser field!!
A user can create and manage all departments.: E.g. someone from the central commission can add a new department and close an existing one.
A user is a department manager: Can create and delete accounts and user profiles for everyone in a department.
A user is an “intro vagt”: Someone who can create new accounts
A user is a team link: Can manage volunteer shifts
A user owns an account: Can add credit card, can add others to the account
CONCEPT OF THIS MODEL: Create boolean fields for different permissions, create lots of them! We want to be very explicit.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
all_permissions
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
can_add_user_profiles
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
can_change_account
¶ 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.
-
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.Manager object>¶
-
userprofile_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
userprofilepermission_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
eggplant.permissions.models.
UserProfilePermission
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Link between a user profile and a set of permissions (a role).
Example 1:
Check if a user has user creation access to a department: can_add_users = department.userprofilepermission_set.filter( user_profile__user=request.user, permission__can_add_user_profiles=True ).exists() if can_add_users: obama_speech = "YES WE CAN" print(obama_speech) Example 2: Check if user can manage an account, like changing the data: can_change_account = account.userprofilepermission_set.filter( user_profile__user=request.user, permission__can_change_accounts=True, ) if not can_change_account: return HttpNotAllowed("piss off")
TODO: Create decorators to manage this easier!
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
account
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
account_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
department
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
department_id
¶ 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.
-
is_global
¶ 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.Manager object>¶
-
permission
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
permission_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user_profile
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
user_profile_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
Module contents¶
eggplant.profiles package¶
Submodules¶
eggplant.profiles.admin module¶
eggplant.profiles.forms module¶
-
class
eggplant.profiles.forms.
NewUserSetPasswordForm
(*args, **kwargs)[source]¶ Bases:
allauth.account.forms.SetPasswordForm
-
base_fields
= OrderedDict([('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])¶
-
declared_fields
= OrderedDict([('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])¶
-
media
¶
-
-
class
eggplant.profiles.forms.
ProfileForm
(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, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>)])¶
-
declared_fields
= OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>)])¶
-
media
¶
-
-
class
eggplant.profiles.forms.
SignupForm
(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, field_order=None, use_required_attribute=None)[source]¶ Bases:
eggplant.profiles.forms.ProfileForm
-
base_fields
= OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>), ('email', <django.forms.fields.EmailField object>), ('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])¶
-
clean_email
()[source]¶ Check if user is already registered and if so raise validation error.
It may be considered a security hole to inform if a user is registered or not but it improves usability.
-
declared_fields
= OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>), ('email', <django.forms.fields.EmailField object>), ('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])¶
-
media
¶
-
eggplant.profiles.middleware module¶
eggplant.profiles.models module¶
-
class
eggplant.profiles.models.
UserProfile
(id, user, middle_name, address, postcode, city, tel, tel2, sex, photo, created, changed)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
FEMALE
= 'female'¶
-
MALE
= 'male'¶
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
OTHER
= 'other'¶
-
SEX_CHOICES
= (('', '-----'), ('female', 'female'), ('male', 'male'), ('other', 'other'))¶
-
accounts
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
address
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
administrator_for
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
changed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
city
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
full_name
¶ Returns member’s full name.
-
get_next_by_changed
(*moreargs, **morekwargs)¶
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_changed
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_sex_display
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
classmethod
in_department
(department, only_active_accounts=True)[source]¶ Returns the user profiles linked to the given department via: UserProfile -> Account -> DepartmentMembership -> Department
-
middle_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.Manager object>¶
-
permissions
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
photo
¶ Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
-
postcode
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
sex
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tel
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tel2
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
userprofilepermission_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
eggplant.profiles.tests module¶
eggplant.profiles.urls module¶
eggplant.profiles.views module¶
-
class
eggplant.profiles.views.
NewUserPassword
(**kwargs)[source]¶ Bases:
eggplant.core.views.LoginRequiredMixin
,allauth.account.views.PasswordSetView
Set password only for a new user. Existing users can use password change.
-
form_class
¶ alias of
NewUserSetPasswordForm
-
success_url
= <django.utils.functional.__proxy__ object>¶
-
-
class
eggplant.profiles.views.
Profile
(**kwargs)[source]¶ Bases:
eggplant.core.views.LoginRequiredMixin
,django.views.generic.edit.FormView
Profile form view.
-
form_class
¶ alias of
ProfileForm
-
success_url
= <django.utils.functional.__proxy__ object>¶
-
template_name
= 'eggplant/profiles/profile_detail.html'¶
-
Module contents¶
eggplant.roles package¶
Subpackages¶
Submodules¶
eggplant.roles.admin module¶
eggplant.roles.models module¶
-
class
eggplant.roles.models.
RoleAssignment
(id, role, user)[source]¶ Bases:
django.db.models.base.Model
-
ACCOUNTANT
= 'accountant'¶
-
CASHIER
= 'cashier'¶
-
COMMUNICATOR
= 'communicator'¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
PACKER
= 'packer'¶
-
PURCHASER
= 'purchaser'¶
-
ROLE_CHOICES
= (('purchaser', <django.utils.functional.__proxy__ object>), ('communicator', <django.utils.functional.__proxy__ object>), ('packer', <django.utils.functional.__proxy__ object>), ('cashier', <django.utils.functional.__proxy__ object>), ('accountant', <django.utils.functional.__proxy__ object>))¶
-
get_role_display
(*moreargs, **morekwargs)¶
-
id
¶ 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.Manager object>¶
-
role
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
eggplant.roles.urls module¶
eggplant.roles.views module¶
Module contents¶
Submodules¶
eggplant.factories module¶
eggplant.urls module¶
Module contents¶
Eggplant is an open source food coop platform.
It allows buying and selling food products directly between farmers and consumers, cutting out the middle man, transportation, packaging etc.
Eggplant is good for the environment and good for you.
Eggplant¶
Eggplant is an open source web application that provides simple and flexible infrastructure for organizing food coops and other local community-driven projects.
Get in touch¶
We use Slack for ad-hoc communication: Click to recieve an invitation. The techical discussion takes place on IRC #eggplant (Freenode) and Slack#teamblue (both rooms automatically forward to each other). The design and organisational issues can also be raised on Slack#teamgreen.
How to contribute¶
Read our documentation to get started reporting bugs, developing code etc. The project description, organization and goals are on our website eggplant.dk. The list of tickets is available on our GitHub project.
Write code, write tests, have fun.