示例#1
0
def ajax_route(request, id):
    from markernos import PlaceMarkernos

    placeMarkernos = PlaceMarkernos()
    retval = placeMarkernos.automarkerno(start_id=id)

    if not retval == True:
        return HttpResponse(retval)
    else:
        return HttpResponse('')
示例#2
0
def ajax_route(request, id):
    from markernos import PlaceMarkernos
    
    placeMarkernos = PlaceMarkernos() 
    retval = placeMarkernos.automarkerno(start_id=id)     

    if not retval == True:
        return HttpResponse(retval)
    else:
        return HttpResponse('')
示例#3
0
    def delete(self, *args, **kw):
        # If so, handle renumbering
        # kw['handleMarkernos'] is set in test to quickly clone Places. Do not want to process markernos
        if not 'handleMarkernos' in kw or kw['handleMarkernos']:
            placeMarkernos = PlaceMarkernos(self, isdeleted=True)
            placeMarkernos.handleChange()

        if 'handleMarkernos' in kw:
            del (kw['handleMarkernos'])  # was just temp

        super(Place, self).delete(*args, **kw)
示例#4
0
 def delete(self, *args, **kw):
     # If so, handle renumbering
     # kw['handleMarkernos'] is set in test to quickly clone Places. Do not want to process markernos
     if not 'handleMarkernos' in kw or kw['handleMarkernos']:
         placeMarkernos = PlaceMarkernos(self, isdeleted = True)
         placeMarkernos.handleChange()
         
     if 'handleMarkernos' in kw:
         del(kw['handleMarkernos']) # was just temp
     
     super(Place, self).delete(*args, **kw)
示例#5
0
def admin_updatemarkernos(request):
    from markernos import PlaceMarkernos
    from django.http import HttpResponseRedirect
    
    territoryno = request.session.get('territoryno')

    if not territoryno:
        raise ValueError("No territoryno!")
    
    # get places that need to be assigned numbers based on routemarkernoafter in descending order
    for place in Place.objects.filter(territoryno=territoryno).filter(routemarkernoafter__gt=0).order_by("-routemarkernoafter"):
        print place.routemarkernoafter
        
        placeMarkernos = PlaceMarkernos(place)        
        placeMarkernos.updateMarkernos()
        
    return HttpResponseRedirect("/map/?territoryno=%s" % territoryno)    
示例#6
0
def admin_updatemarkernos(request):
    from markernos import PlaceMarkernos
    from django.http import HttpResponseRedirect

    territoryno = request.session.get('territoryno')

    if not territoryno:
        raise ValueError("No territoryno!")

    # get places that need to be assigned numbers based on routemarkernoafter in descending order
    for place in Place.objects.filter(territoryno=territoryno).filter(
            routemarkernoafter__gt=0).order_by("-routemarkernoafter"):
        print place.routemarkernoafter

        placeMarkernos = PlaceMarkernos(place)
        placeMarkernos.updateMarkernos()

    return HttpResponseRedirect("/map/?territoryno=%s" % territoryno)
示例#7
0
    def save(self, *args, **kw):
        self.ParseDetails()
        self.geocoded = True if (self.point.y and self.point.x) else False

        # gonna try ignoring new markers to later assign number
        if self.id:
            # In order to handle renumbering of markerno's, I need to see if markno has changed.
            # If so, handle renumbering
            # kw['handleMarkernos'] is set in test to quickly clone Places. Do not want to process markernos
            if not 'handleMarkernos' in kw or kw['handleMarkernos']:
                isnew = True if not self.id else False
                placeMarkernos = PlaceMarkernos(self, isnew=isnew)
                placeMarkernos.handleChange()

        if 'handleMarkernos' in kw:
            del (kw['handleMarkernos'])  # was just temp

        super(Place, self).save(*args, **kw)
示例#8
0
def admin_automarkerno(request, id=None):
    from django.http import HttpResponseRedirect
    from markernos import PlaceMarkernos

    territoryno = request.session.get('territoryno')

    if not territoryno:
        error = "No territoryno!"
        return HttpResponse('ERROR: %s' % error)

    start_id = request.session.get('id', id)

    placeMarkernos = PlaceMarkernos()
    retval = placeMarkernos.automarkerno(start_id=id, territoryno=territoryno)

    if not retval == True:
        raise ValueError(retval)

    return HttpResponseRedirect("/map/?territoryno=%s" % territoryno)
示例#9
0
def admin_automarkerno(request, id = None):
    from django.http import HttpResponseRedirect
    from markernos import PlaceMarkernos
    
    territoryno = request.session.get('territoryno')

    if not territoryno:
        error = "No territoryno!"
        return HttpResponse('ERROR: %s' % error)
    
    start_id = request.session.get('id', id) 
    
    placeMarkernos = PlaceMarkernos() 
    retval = placeMarkernos.automarkerno(start_id=id, territoryno=territoryno)    
    
    if not retval == True:
        raise ValueError(retval)
    
    return HttpResponseRedirect("/map/?territoryno=%s" % territoryno)
示例#10
0
 def save(self, *args, **kw):
     self.ParseDetails()
     self.geocoded = True if (self.point.y and self.point.x) else False
     
     
     # gonna try ignoring new markers to later assign number
     if self.id:
         # In order to handle renumbering of markerno's, I need to see if markno has changed.
         # If so, handle renumbering
         # kw['handleMarkernos'] is set in test to quickly clone Places. Do not want to process markernos
         if not 'handleMarkernos' in kw or kw['handleMarkernos']:
             isnew = True if not self.id else False
             placeMarkernos = PlaceMarkernos(self, isnew = isnew)
             placeMarkernos.handleChange()
             
     if 'handleMarkernos' in kw:
         del(kw['handleMarkernos']) # was just temp
         
     super(Place, self).save(*args, **kw)