# Path: telostats/stations/models.py
# class Station(models.Model):
#     id = models.IntegerField(unique=True, primary_key=True)
#     name = models.CharField(u'name', max_length=100)
#     address = models.CharField(u'address', max_length=100, null=True, blank=True)
#     longitude = models.FloatField(u'longitude')
#     latitude = models.FloatField(u'latitude')
#     polygon = JSONField(u'polygon')
#     poles = models.IntegerField(u'poles')
#     available = models.IntegerField(u'available')
#     visible = models.BooleanField(u'visible', default=False)
# 
#     objects = models.Manager()
#     visible_objects = VisibleStationManager()
# 
#     def __unicode__(self):
#         return u'({}) {}'.format(self.id, self.name)
# 
#     def available_poles(self):
#         return self.available
# 
#     def available_bikes(self):
#         return self.poles - self.available


from django.conf import settings
from django.core.mail import send_mail
from django.http import HttpResponseRedirect
from django.views.generic import DetailView, TemplateView
from djpjax import PJAXResponseMixin
from .models import Station



class StationMap(TemplateView):
    template_name = 'map.html'

    def get_context_data(self, **kwargs):
        context = super(StationMap, self).get_context_data(**kwargs)
        context['tileserver_url'] = settings.TILESERVER_URL
        return context


class StationDetail(PJAXResponseMixin, DetailView):

# Path: telostats/stations/models.py
# class Station(models.Model):
#     id = models.IntegerField(unique=True, primary_key=True)
#     name = models.CharField(u'name', max_length=100)
#     address = models.CharField(u'address', max_length=100, null=True, blank=True)
#     longitude = models.FloatField(u'longitude')
#     latitude = models.FloatField(u'latitude')
#     polygon = JSONField(u'polygon')
#     poles = models.IntegerField(u'poles')
#     available = models.IntegerField(u'available')
#     visible = models.BooleanField(u'visible', default=False)
# 
#     objects = models.Manager()
#     visible_objects = VisibleStationManager()
# 
#     def __unicode__(self):
#         return u'({}) {}'.format(self.id, self.name)
# 
#     def available_poles(self):
#         return self.available
# 
#     def available_bikes(self):
#         return self.poles - self.available


# Path: telostats/stations/views.py
from django.conf import settings
from django.core.mail import send_mail
from django.http import HttpResponseRedirect
from django.views.generic import DetailView, TemplateView
from djpjax import PJAXResponseMixin
from .models import Station




class StationMap(TemplateView):
    template_name = 'map.html'

    def get_context_data(self, **kwargs):
        context = super(StationMap, self).get_context_data(**kwargs)
        context['tileserver_url'] = settings.TILESERVER_URL
        return context


class StationDetail(PJAXResponseMixin, DetailView):

    model = Station