Ejemplo n.º 1
0
def _available_ustation_list():

    _t_top = datetime.datetime.now()
    _t_bottom = datetime.datetime.now() - datetime.timedelta(hours=48)

    _entity_context_list = []
    _entity_id_set = set()
    for _item_info in Item.find_ustation():
        _entity_context = _get_ustation_entity(_item_info['entity_id'])
        if _entity_context != None:
            _entity_context_list.append(_entity_context)
            _entity_id_set.add(_item_info['entity_id'])

    for _selection in NoteSelection.objects.filter(
            post_time__lt=_t_top,
            post_time__gt=_t_bottom).order_by('-post_time'):
        try:
            if not _selection.entity_id in _entity_id_set:
                _entity_context = _get_ustation_entity(_selection.entity_id,
                                                       True)
                if _entity_context != None:
                    _entity_context_list.append(_entity_context)
                    _entity_id_set.add(_selection.entity_id)
        except Exception, e:
            pass
Ejemplo n.º 2
0
def clean_ustation(request):
    for _item_info in Item.find_ustation():
        _item = Item(_item_info['item_id'])
        _item.update(ustation=1)

    return HttpResponseRedirect(reverse('management_ustation_list'))