Commit 64ed282f authored by Baptiste Jonglez's avatar Baptiste Jonglez
Browse files

Merge branch 'master' into call_for_membership_fees

parents a2225e1b d183023e
......@@ -39,8 +39,11 @@ This user account has access to the administration interface.
Quickstart
==========
Get yourself a virtualenv. On Debian, install `python-virtualenv`. On
Archlinux, the package is called `python2-virtualenv`, and you must
Virtualenv
----------
Using a virtualenv is recommended. On Debian, install `python-virtualenv`.
On Archlinux, the package is called `python2-virtualenv`, and you must
replace the `virtualenv` command with `virtualenv2` in the following.
To create the virtualenv (the first time):
......@@ -69,6 +72,9 @@ You may experience problems with SSL certificates du to self-signed cert used by
You should now be able to run `python manage.py` (within the
virtualenv, obviously) without error.
Settings
--------
The `coin/settings_local.py` file is ignored by Git: feel free to override any
setting by writing into that file. For example, to override the `DEBUG`
settings:
......@@ -76,14 +82,24 @@ settings:
echo '# -*- coding: utf-8 -*-' > coin/settings_local.py
echo 'DEBUG = TEMPLATE_DEBUG = True' >> coin/settings_local.py
At this point, you should setup your database. Recommended is postgreSQL,
but you might be able to use SQLite. For more information, see https://www.illyse.org/projects/ils-si/wiki/Mise_en_place_environnement_de_dev
If you don't want to use LDAP, just set in your `settings_local.py`:
LDAP_ACTIVATE = False
See the end of this README for a reference of available configuration settings.
Database
--------
At this point, you should setup your database: we highly recommend PostgreSQL.
SQLite might work, but some features will not be available:
- automatic allocation of IP subnet
For more information on the database setup, see:
https://www.illyse.org/projects/ils-si/wiki/Mise_en_place_environnement_de_dev
The first time, you need to create the database, create a superuser, and
import some base data to play with:
......@@ -95,8 +111,10 @@ Note that the superuser will be inserted into the LDAP backend exactly in the
same way as all other members, so you should use a real account (not just
admin/admin).
Then, at each code update, you only need to apply migrations:
Then, at each code update, you will only need to update dependencies and apply
new migrations:
pip install -r requirements.txt
python manage.py migrate
......
......@@ -36,6 +36,17 @@ class ISPInfo(SingleInstanceMixin, models.Model):
The naming convention is different from Python/django so that it
matches exactly the format (which uses CamelCase...)
"""
# These two properties can be overriden with static counters, see below.
@property
def memberCount(self):
"""Number of members"""
return count_active_members()
@property
def subscriberCount(self):
"""Number of subscribers to an internet access"""
return count_active_subscriptions()
name = models.CharField(max_length=512,
help_text="The ISP's name")
# Length required by the spec
......@@ -70,10 +81,14 @@ class ISPInfo(SingleInstanceMixin, models.Model):
longitude = models.FloatField(blank=True, null=True,
help_text="Coordinates of the registered office (longitude)")
# Uncomment this if you want to manage these counters by hand.
#member_count = models.PositiveIntegerField(help_text="Number of members")
#subscriber_count = models.PositiveIntegerField(
# help_text="Number of subscribers to an internet access")
# Uncomment this (and handle the necessary migrations) if you want to
# manage one of the counters by hand. Otherwise, they are computed
# automatically, which is probably what you want.
#memberCount = models.PositiveIntegerField(help_text="Number of members",
# default=0)
#subscriberCount = models.PositiveIntegerField(
# help_text="Number of subscribers to an internet access",
# default=0)
# field outside of db-ffdn format:
administrative_email = models.EmailField(
......@@ -88,16 +103,6 @@ class ISPInfo(SingleInstanceMixin, models.Model):
verbose_name="serveur de listes", blank=True,
help_text="URL du serveur de listes de discussions/diffusion")
@property
def memberCount(self):
"""Number of members"""
return count_active_members()
@property
def subscriberCount(self):
"""Number of subscribers to an internet access"""
return count_active_subscriptions()
@property
def version(self):
"""Version of the API"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment