From 6ceb06120534523813dd44e5ed007a6c943d3bbf Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sun, 28 Jun 2015 16:23:28 +0200 Subject: [PATCH] Improve documentation formatting --- doc/development/goals.rst | 2 +- doc/development/structure.rst | 8 +++++++- doc/index.rst | 7 +------ src/pretix/base/models.py | 11 ++++++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/doc/development/goals.rst b/doc/development/goals.rst index c1021e450..49e23341f 100644 --- a/doc/development/goals.rst +++ b/doc/development/goals.rst @@ -19,7 +19,7 @@ Feature goals * One pretix software installation has to cope with multiple events by multiple organizers * There is no code access necessary to create a new event -*Tixe is abstract in many ways to adopt to as much events as possible. +* Pretix is abstract in many ways to adopt to as much events as possible. * Tickets are only an instance of an abstract model called items, such that the system can also sell e.g. merchandise * An abstract concept of restriction is used to restrict the selling of tickets, for example by date, by number or by user permissions. diff --git a/doc/development/structure.rst b/doc/development/structure.rst index 34fce3aa3..2731eb59c 100644 --- a/doc/development/structure.rst +++ b/doc/development/structure.rst @@ -24,12 +24,18 @@ pretix/ Django or installed 3rd-party packages, like a filter to combine the ``lessc`` preprocessor with ``django-compressor``'s URL rewriting. +tests/ + This is the root directory for all test codes. It includes subdirectories ``base``, + ``control``, ``presale``, ``helpers`` and ``plugins`` to mirror the structure of the + ``pretix`` source code as well as ``testdummy``, which is a pretix plugin used during + testing. + Language files -------------- The language files live in ``locale/*/LC_MESSAGES/``. Static files -------------- +------------ LESS source code ^^^^^^^^^^^^^^^^ diff --git a/doc/index.rst b/doc/index.rst index eadea83f7..acd7cd8a1 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,10 +1,5 @@ -.. pretix documentation master file, created by - sphinx-quickstart on Mon Sep 8 15:13:08 2014. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - Welcome to pretix's documentation! -================================ +================================== Contents: diff --git a/src/pretix/base/models.py b/src/pretix/base/models.py index c3b578570..c426efc5b 100644 --- a/src/pretix/base/models.py +++ b/src/pretix/base/models.py @@ -123,12 +123,14 @@ class User(AbstractBaseUser, PermissionsMixin): This is the user model used by pretix for authentication. Handling users is somehow complicated, as we try to have two classes of users in one system: + (1) We want *global* users who can just login into pretix and buy tickets for multiple events -- we also need those global users for event organizers who should not need multiple users for managing multiple events. (2) We want *local* users who exist only in the scope of a certain event + The hard part is to find a primary key to identify all of these users. Letting the users choose usernames is a bad idea, as the primary key needs to be unique and there is no reason for a @@ -139,11 +141,13 @@ class User(AbstractBaseUser, PermissionsMixin): to supply an e-mail address. Therefore, we use an abstract "identifier" field as the primary key. The identifier is: + (1) the e-mail address for global users. An e-mail address is and should be required for them and global users use their e-mail address for login. (2) "{username}@{event.identity}.event.pretix" for local users, who use their username to login on the event page. + The model's save() method automatically fills the identifier field according to this scheme when it is empty. The __str__() method returns the identifier. @@ -1342,8 +1346,8 @@ class Quota(Versionable): This method is used to determine whether Items or ItemVariations belonging to this quota should currently be available for sale. - :returns: a tuple where the first entry is one of the Quota.AVAILABILITY_ constants and the second - is the number of available tickets. + :returns: a tuple where the first entry is one of the ``Quota.AVAILABILITY_`` constants + and the second is the number of available tickets. """ # TODO: These lookups are highly inefficient. However, we'll wait with optimizing # until Django 1.8 is released, as the following feature might make it a @@ -1397,7 +1401,8 @@ class Quota(Versionable): Issue a lock on this quota so nobody can take tickets from this quota until you release the lock. Will retry 5 times on failure. - :raises Quota.LockTimeoutException: if the quota is locked every time we try to obtain the lock + :raises Quota.LockTimeoutException: if the quota is locked every time we try + to obtain the lock """ retries = 5 for i in range(retries):