~lars-luthman-deactivatedaccount/ppvalbok/remove-bookings

« back to all changes in this revision

Viewing changes to ballot_system/management.py

  • Committer: Lars Luthman
  • Date: 2009-04-24 09:13:52 UTC
  • Revision ID: lars.luthman@gmail.com-20090424091352-e44kcf6d1q57ujhj
Added comments for all classes and functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
 
6
6
def create_data_for_region(sender, instance, **kwargs):
 
7
    """
 
8
    This should be called whenever a new Region is saved into the database.
 
9
    It creates an additional object that holds all dynamic data for that
 
10
    region.
 
11
    """
7
12
    if len(RegionData.objects.filter(region=instance)) == 0:
8
13
        data = RegionData(region=instance)
9
14
        data.save()
10
15
 
11
16
 
12
17
def create_data_for_evs(sender, instance, **kwargs):
 
18
    """
 
19
    This should be called whenever a new EarlyVotingStation is saved into
 
20
    the database. It creates an additional object that holds all dynamic
 
21
    data for that station.
 
22
    """
13
23
    if len(EVSData.objects.filter(earlyvotingstation=instance)) == 0:
14
24
        data = EVSData(earlyvotingstation=instance)
15
25
        data.save()
16
26
 
17
27
 
18
28
def create_data_for_vs(sender, instance, **kwargs):
 
29
    """
 
30
    This should be called whenever a new VotingStation is saved into
 
31
    the database. It creates an additional object that holds all dynamic
 
32
    data for that station.
 
33
    """
19
34
    if len(VSData.objects.filter(votingstation=instance)) == 0:
20
35
        data = VSData(votingstation=instance)
21
36
        data.save()