def save(self, *args, **kwargs): """ Creates a new ``Checkin`` for a user. This can be done for anonymous users or for real users. Since we call ``checkin.save()`` here, the ``save()`` override will take care of expiring older checkins for the given user. """ self.pre_save(*args, **kwargs) checkin = Checkin() checkin.place = self.place if self.user: checkin.user = self.user else: checkin.user_name = self.cleaned_data['user_name'] checkin.point = Point( self.cleaned_data['lng'], self.cleaned_data['lat'], ) checkin.save() from matchmaker import facebook if (self.cleaned_data.get('access_token') and self.cleaned_data.get('post_to_facebook')): graph = facebook.GraphAPI(self.cleaned_data.get('access_token')) graph.put_wall_post( "I'm playing basketball now at {0}." ' Come and join me: {1}{2}'.format( self.place, settings.HOSTNAME, self.place.get_absolute_url() )) return checkin
def save(self, *args, **kwargs): """ Creates a new ``Checkin`` for a user. This can be done for anonymous users or for real users. Since we call ``checkin.save()`` here, the ``save()`` override will take care of expiring older checkins for the given user. """ self.pre_save(*args, **kwargs) checkin = Checkin() checkin.place = self.place if self.user: checkin.user = self.user else: checkin.user_name = self.cleaned_data['user_name'] checkin.point = Point( self.cleaned_data['lng'], self.cleaned_data['lat'], ) checkin.save() from matchmaker import facebook if (self.cleaned_data.get('access_token') and self.cleaned_data.get('post_to_facebook')): graph = facebook.GraphAPI(self.cleaned_data.get('access_token')) graph.put_wall_post("I'm playing basketball now at {0}." ' Come and join me: {1}{2}'.format( self.place, settings.HOSTNAME, self.place.get_absolute_url())) return checkin