示例#1
0
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
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")