コード例 #1
0
ファイル: forms_admins.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/forms_admins.py")
コード例 #2
0
ファイル: models.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/models.py")

from .configuration import OccurrenceSpecific, ConfigNature
from . import tag
from . import utils_path

# TODO sort out the enumeration
from data_manager.enumerations import Country

from django.db.models import Q

from functools import partial
import collections, os


class OccurrenceOrigin():
    ORIGINAL = u'OR'
    BUY_USAGE = u'BU'
    BUY_COLLEC = u'BC'
    #For lost/stolen original elements...
    BUY_AGAIN = u'BA'
    GIFT = u'GF'

    DataTuple = collections.namedtuple("OriginDataTuple", ["ui_value", "tag_color"])
    #colors, see : http://www.w3schools.com/html/html_colornames.asp
    DATA = collections.OrderedDict((
        (ORIGINAL,    DataTuple(u'Original',        'red')),
        (BUY_USAGE,   DataTuple(u'Buy usage',       'royalblue')),
        (BUY_COLLEC,  DataTuple(u'Buy collection',  'green')),
コード例 #3
0
ファイル: utils_path.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/utils_path.py")
コード例 #4
0
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/config_utils.py")
コード例 #5
0
ファイル: models.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/models.py")

from .configuration import OccurrenceSpecific, ConfigNature
from . import tag
from . import utils_path

# TODO sort out the enumeration
from data_manager.enumerations import Country

from django.db.models import Q

from functools import partial
import collections, os


class OccurrenceOrigin():
    ORIGINAL = u'OR'
    BUY_USAGE = u'BU'
    BUY_COLLEC = u'BC'
    #For lost/stolen original elements...
    BUY_AGAIN = u'BA'
    GIFT = u'GF'

    DataTuple = collections.namedtuple("OriginDataTuple",
                                       ["ui_value", "tag_color"])
    #colors, see : http://www.w3schools.com/html/html_colornames.asp
    DATA = collections.OrderedDict((
        (ORIGINAL, DataTuple(u'Original', 'red')),
        (BUY_USAGE, DataTuple(u'Buy usage', 'royalblue')),
コード例 #6
0
ファイル: utils.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/utils.py")


def find_interface_detail(specification_interface):
    """
    Given a BaseSpecificationInterface instance, return its corresponding 
    SystemInterfaceDetail or CommonInterfaceDetail instance.
    """
    try:
        interface_detail = \
            SystemInterfaceDetail.objects.get(interfacedetailbase_ptr=specification_interface.interface_detail_base)
    except SystemInterfaceDetail.DoesNotExist:
        interface_detail = \
            CommonInterfaceDetail.objects.get(interfacedetailbase_ptr=specification_interface.interface_detail_base)
    return interface_detail
        

def region_ancestors(region):
    """ Returns the ancestors of 'region', but not region itself, from the direct parent up """
    ancestors = []
    parent = region.parent_region
    while parent:
        ancestors.append(parent)
        parent = parent.parent_region
    return ancestors


def is_region_superset(regions_superset, regions_subset):
    """
コード例 #7
0
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/views.py")
コード例 #8
0
ファイル: admin.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/admin.py")

##
## Customization starts here
##

from .models import *
from . import config_utils
from .forms_admins import SaveEmptyDataModelForm

from data_manager import utils_id

from django.utils.html import format_html
from django.contrib import admin

##
## Edit the data_manager admin
##

## Concept name scoping ##
class ConceptAdminForm(forms.models.ModelForm):
    def clean(self):
        """
        Enforces some uniqueness constraints : 
        If two concepts have the same "distinctive name" and the same "year" 
        their name need to have different "scopes"
        """
        data = self.cleaned_data
        if "distinctive_name" not in data:
コード例 #9
0
ファイル: urls.py プロジェクト: Adnn/Collecster
from data_manager.collecster_exec import collecster_exec

collecster_exec("data_manager/urls.py")