def create_halt(self,name,latitude=None,longitude=None,zip=None): alias = name_for_linking(name) halt = self.exists(alias=alias) if halt: return halt halt = Halt(name=name,alias=alias,latitude=latitude,longitude=longitude,zip=zip) halt.save() return halt
def create_restaurant(self, name, address,status='0'): from utils import name_for_linking try: alias = name_for_linking('%s' % name.lower()) return self.get(alias=alias) except Restaurant.DoesNotExist: restaurant = Restaurant(name=name, alias=alias, address=address,status=status) restaurant.save() return restaurant
def create_mess(self, name, address,status='0'): from utils import name_for_linking alias = name_for_linking('%s' % name.lower()) try: return self.get(alias=alias) except Mess.DoesNotExist: mess = Mess(name=name, alias=alias, address=address,status=status) mess.save() return mess
def create_fooditem(self,name,type='Veg',tags=[]): from utils import name_for_linking alias = name_for_linking('%s' % name.lower()) fooditem = self._check_exists(alias = alias) if not fooditem: fooditem = FoodItem(name=name,type=type,alias=alias) fooditem.save() if tags: for tag in tags: fooditem.tags.add(tag) return fooditem