This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageListView(ListView): | |
model = Image | |
template_name = "main/image_list.html" | |
paginate_by = 10 | |
def get_context_data(self, **kwargs): | |
context = super(ImageListView, self).get_context_data(**kwargs) | |
image_list = Image.objects.all() | |
paginator = Paginator(image_list, self.paginate_by) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE or REPLACE FUNCTION find_remoteness_btw_cords(lat1 double precision, lng1 double precision, lat2 double precision, lng2 double precision) | |
RETURNS double precision | |
LANGUAGE plpgsql AS $$ | |
BEGIN | |
RETURN ACOS(SIN(PI()*lat1/180.0)*SIN(PI()*lat2/180.0)+COS(PI()*lat1/180.0)*COS(PI()*lat2/180.0)*COS(PI()*lng2/180.0-PI()*lng1/180.0))*6367000; | |
END; | |
$$; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = str(input()) | |
l = len(s)-1 | |
c = 1 | |
t = '' | |
if len(s) == 1: | |
t = t + s +str(c) | |
else: | |
for i in range(0,l): | |
if s[i] == s[i+1]: | |
c += 1 |
NewerOlder