コード例 #1
0
 def handle(self, *args, **options):
     quantity = options['qtd']
     for i in range(1, quantity):
         occurrence = Occurrence() 
         occurrence.date_time = get_date()
         occurrence.fact = get_stop_fact()
         occurrence.location = random_stop_position()
         occurrence.route = get_route()
         occurrence.comment = random_comment()
         occurrence.photo = random_photo()
         occurrence.save()
コード例 #2
0
 def save(self, ip_address):
     latitude = self.cleaned_data['latitude']
     longitude = self.cleaned_data['longitude']
     
     occurrence = Occurrence()
     occurrence.fact = self.fact
     occurrence.date_time = self.cleaned_data['date_time']
     occurrence.location = Point(y=latitude, x=longitude, srid=4326)
     occurrence.route = self.route
     occurrence.ip_address = ip_address
     return occurrence.save()