예제 #1
0
파일: models.py 프로젝트: dxplatov/mytaxi
class Order_detail(models.Model):
    NEW = "NEW"
    ACCEPTED = "ACCEPTED"
    ARRIVED = "ARRIVED"
    INCAB = "INCAB"
    FINISHED = "FINISHED"
    CANCEL = "CANCEL"

    STATUS_CHOICES = ((NEW, "NEW"), (ACCEPTED, "ACCEPTED"),
                      (ARRIVED, "ARRIVED"), (INCAB, "INCAB"),
                      (FINISHED, "FINISHED"), (CANCEL, "CANCEL"))
    STANDART = "STANDART"
    COMFORT = "COMFORT"
    BUSSINESS = "BUSSINESS"

    RANK_CHOICES = (
        (STANDART, "STANDART"),
        (COMFORT, "COMFORT"),
        (BUSSINESS, "BUSSINESS"),
    )
    order_customer = models.ForeignKey(User, on_delete=models.CASCADE)
    order_cost = models.FloatField()
    order_start_time = models.DateTimeField(auto_now_add=True)
    order_finish_time = models.DateTimeField(auto_now=True)
    order_rank = models.CharField(max_length=15,
                                  choices=RANK_CHOICES,
                                  default="STANDART")
    order_status = models.CharField(max_length=15,
                                    choices=STATUS_CHOICES,
                                    default="NEW")
    start_point = models.PointField()
    dest_point = models.PointField()

    def __str__(self):
        return self.order_rank
예제 #2
0
class Cast(RootAC):
    destination = models.PointField(blank=True, null=True)
    origin = models.PointField(blank=True, null=True)
    name = models.CharField(max_length=250, blank=True)
    explanation = models.TextField(blank=True)
    speed = models.IntegerField(blank=True)
    has_arrived = models.NullBooleanField(default=None)
    is_a_recast = models.NullBooleanField(default=None)
    needs_review = models.NullBooleanField(default=None)
    arrival = models.DateTimeField(blank=True)

    sender = models.ForeignKey(User, null=True)

    artwork_name = models.CharField(max_length=250, blank=True)
    recast_count = models.IntegerField(blank=True, null=True)

    time = models.DateTimeField(blank=True, null=True)
    year = models.IntegerField(blank=True, null=True)
    month = models.IntegerField(blank=True, null=True)
    day = models.IntegerField(blank=True, null=True)

    here_before = models.NullBooleanField(default=None)
    user_url = models.URLField(blank=True)

    tags = ArrayField(models.CharField(max_length=250), blank=True, null=True)

    def __unicode__(self):
        return str(self.id)
예제 #3
0
class Passengerinfo(models.Model):
    passDestination = models.PointField(null=True)
    passLocation = models.PointField(null=True)

    class Meta:
        verbose_name_plural = 'Passengerinfo'

    def __str__(self):
        return str(self.passLocation)
예제 #4
0
class Route(models.Model):
    id = models.AutoField(primary_key=True)
    driver = models.ForeignKey(Driver, on_delete=models.CASCADE)
    origin_name = models.CharField(max_length=50)
    destination_name = models.CharField(max_length=50)
    origin = models.PointField(null=True, blank=True)
    destination = models.PointField(null=True, blank=True)
    date = models.DateTimeField(default=now, blank=True)
    passengers = models.ManyToManyField(Passenger, blank=True)
예제 #5
0
class ponto1(models.Model):

    nome = models.CharField(max_length=200)
    nome2 = models.CharField(max_length=200)
    ponto1  = models.PointField(srid=4326)
    ponto2  = models.PointField(srid=4326)
    d = models.CharField(max_length=200)


    def __unicode__(self):
    	return self.nome
예제 #6
0
class Location(models.Model):
    """
    Stores location lookup for when user queries on specific location
    """
    shortcode = models.CharField(max_length=100)
    scale = models.FloatField(max_length=100, default=0)
    town = models.CharField(max_length=100)
    county = models.CharField(max_length=100)
    country = models.CharField(max_length=100)
    population = models.CharField(max_length=100)
    latitude = models.CharField(max_length=100)
    longitude = models.CharField(max_length=100)
    url = models.CharField(max_length=100)
    location = models.PointField(null=True, blank=True)

    class Meta:
        ordering = ('county', 'town')
        indexes = [
            models.Index(fields=[
                'shortcode',
            ]),
            models.Index(fields=[
                'town',
            ]),
        ]

    def __str__(self):
        return self.town + ", " + self.county
예제 #7
0
class Location(models.Model):
    #latitude and longitude need to be changed to string types for GeoDjango
    latitude = models.CharField(max_length=15, blank=True, null=True)
    longitude = models.CharField(max_length=15, blank=True, null=True)

    #overriding the default manager with a GeoManager instance.
    #Changing geography to equal False, and dim(dimension to 2) This will use a geom type and be compatible with the admin polygons
    geom = models.PointField(dim=2, geography=False, blank=True, null=True)
    objects = models.GeoManager()

    def save(self, input_id):
        if self.latitude != None and len(self.latitude) > 0:
            lString = 'POINT(%s %s)' % (self.longitude.strip(),
                                        self.latitude.strip())
            self.geom = fromstr(lString)
        super(Location, self).save()

        if self.latitude != None and len(self.latitude) > 0:
            #whenever a location is saved, it creates a new tuple for the Location_w_efforts table, to keep the table up to date
            Location_w_effortsObj = Location_w_efforts()
            Location_w_effortsObj.provider_name = 'test1'
            Location_w_effortsObj.latitude = self.latitude
            Location_w_effortsObj.longitude = self.longitude
            Location_w_effortsObj.id = self.id
            Location_w_effortsObj.date_start = EffortInstance.objects.get(
                effort_instance_id=input_id).date_start
            Location_w_effortsObj.date_end = EffortInstance.objects.get(
                effort_instance_id=input_id).date_end
            provider_num = EffortInstance.objects.get(
                effort_instance_id=input_id).service_provider
            Location_w_effortsObj.service_provider = provider_num
            Location_w_effortsObj.provider_name = ServiceProvider.objects.get(
                service_provider_id=provider_num.service_provider_id
            ).provider_name
            Location_w_effortsObj.save()
예제 #8
0
class Location(models.Model):
    # using django fields to represent database
    location = models.CharField(max_length=100)
    geom = models.PointField()

    def _str_(self):
        return self.location
예제 #9
0
class Pickup_Location(models.Model):
    pointer = models.ForeignKey(User, on_delete=models.CASCADE)
    name = models.CharField(max_length=100)
    longitude = models.DecimalField(max_digits=9, decimal_places=6)
    latitude = models.DecimalField(max_digits=9, decimal_places=6)
    geom = models.PointField(srid=4326)
    objects = models.GeoManager()

    def __str__(self):
        return str(self.name)

    def save_pickup(self):
        self.save()

    def delete_pickup(self):
        self.delete()

    @staticmethod
    def update_pickup_location(id, pointer, name, longitude, latitude, geom,
                               objects):

        Pickup_Location.objects.filter(pk=id).update(pointer=pointer,
                                                     name=name,
                                                     longitude=longitude,
                                                     latitude=latitude,
                                                     geom=geom,
                                                     objects=objects)
예제 #10
0
class User(RootAC):
    postcode = models.CharField(max_length=250, blank=True)
    postcode_geolocation = models.PointField(blank=True, null=True)

    age_choices = (('A', "12 or under"), ('B', "13-15"), ('C', "16-17"),
                   ('D', "18-20"), ('E', "21-23"), ('F', "24-25"),
                   ('G', "26-35"), ('H', "36-45"), ('I', "46-55"),
                   ('J', "56-74"), ('K', "75 or older"), ('N', "No Answer"))

    age = models.CharField(max_length=1, choices=age_choices, default="N")

    platform_choices = (
        ('I', 'iOS'),
        ('A', 'Android'),
        ('W', 'Web'),
    )

    platform = models.CharField(max_length=1,
                                choices=platform_choices,
                                blank=True)

    encounters = models.IntegerField(default=0)

    def __unicode__(self):
        return str(self.id)
예제 #11
0
파일: models.py 프로젝트: CNR-ISMAR/ecoads
class EcosSite(models.Model):
    data = JSONField(blank=True, null=True)
    suffix = models.CharField(max_length=200, blank=False, null=True)
    denomination = models.CharField(max_length=200)
    description = models.TextField(blank=True, null=True)
    domain_area = models.MultiPolygonField(blank=True, null=True)  #polygon
    location = models.PointField()  # marker point
    website = models.URLField(max_length=600, blank=True, null=True)
    last_update = models.DateTimeField(blank=True, null=True)
    is_ecoss = models.BooleanField(default=False)
    is_n2k = models.BooleanField(default=False)
    is_lter = models.BooleanField(default=False)
    is_fixoss = models.BooleanField(default=False)
    is_onmap = models.BooleanField(default=False)
    img = models.URLField(max_length=600, blank=True, null=True)
    #measurement_id = models.IntegerField(blank=True, null=True)
    #tutte le location che cadono in quest'area - script @todo
    measurement_location_id = models.ManyToManyField(
        Location, through='EcosSitesLocationDjangoMeasurements', blank=True)
    #data_source = models.ManyToManyField(DataSource, through='EcosSitesDataSources')
    parameters = models.ManyToManyField(Parameter,
                                        through='EcosSitesParameters',
                                        blank=True)
    inforesources = models.ManyToManyField(InfoResource,
                                           through='EcosSitesInfoResources',
                                           blank=True)
    conceptualmodels = models.ManyToManyField(CMPage,
                                              through='EcosSitesCMPages',
                                              blank=True)

    def __str__(self):
        return self.denomination
예제 #12
0
class FocoFIRMS(models.Model):
    #https://earthdata.nasa.gov/files/README_TXT.pdf

    dataregUTC = models.DateTimeField()
    posicao = models.PointField()
    bright = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    scan = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    track = models.DecimalField(default=0, decimal_places=4, max_digits=16)
    dataUTC = models.DateTimeField()
    satellite = models.CharField(max_length=1)
    confidence = models.DecimalField(default=0, decimal_places=2, max_digits=6)
    version = models.CharField(max_length=5)
    brightT31 = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    frp = models.DecimalField(default=0, decimal_places=4, max_digits=16)
    objects = models.GeoManager()

    @property
    def geom(self):
        return self.posicao

    class Meta:
        ordering = [
            'dataUTC',
        ]

    def __unicode__(self):
        return u'{0}'.format(self.dataUTC)
예제 #13
0
class Localisation(models.Model):
    nom = models.CharField(max_length=30)
    adresse = models.CharField(blank=True, null=True, max_length=100)
    ville = models.CharField(blank=True, null=True, max_length=100)
    geocodeAdresse = models.CharField(blank=True, null=True, max_length=200)
    geolocalisation = models.PointField(srid=4326, blank=True, null=True)

    def __str__(self):
        return self.nom

    def save(self, *args, **kwargs):
        if not self.geolocalisation:
            address = u'%s %s' % (self.ville, self.adresse)
            geolocator = Nominatim(country_bias='France', timeout=10)
            try:
                result = geolocator.geocode(address, exactly_one=True)
            except (URLError, ValueError):
                pass
            else:
                #print (address, result)
                self.geolocalisation = GEOSGeometry(
                    'POINT(%s %s)' % (result.longitude, result.latitude)).ewkt
                resultAddress = result.address
                self.geocodeAdresse = resultAddress
        super(Localisation, self).save()
예제 #14
0
파일: models.py 프로젝트: mleon86/gpv_news
class Persona(models.Model):

    nombre = models.CharField("Nombre", max_length=50, blank=False, null=False)
    apellido = models.CharField("Apellido",
                                max_length=50,
                                blank=False,
                                null=False)
    ci_nro = models.CharField("Cedula de identidad",
                              max_length=8,
                              blank=False,
                              null=False,
                              primary_key=True)
    telefono_persona = models.CharField("Teléfono",
                                        max_length=20,
                                        blank=True,
                                        help_text='su numero de contacto')
    pais = CountryField()
    fecha_nacimiento = models.DateField()
    ubicacion = models.PointField()
    direccion = models.CharField("Direccion",
                                 max_length=100,
                                 blank=False,
                                 null=False)
    observacion = models.TextField("Observacion", blank=False, null=False)
    organizacion = models.ForeignKey(Organizacion,
                                     blank=True,
                                     on_delete=models.CASCADE)

    class Meta:
        verbose_name = 'Persona'
        verbose_name_plural = 'Personas'
        ordering = ['ci_nro']

    def __str__(self):
        return '%s %s %s' % (self.ci_nro, self.nombre, self.apellido)
예제 #15
0
파일: models.py 프로젝트: eosnairobi/FAQ2
class BlockProducer(models.Model):
    account_name = models.CharField(max_length=12, unique=True)
    producer_key = models.CharField(max_length=60)
    display_name = models.CharField(max_length=300, blank=True)
    url = models.URLField(blank=True, null=True)
    logo = models.ImageField(null=True,
                             blank=True,
                             upload_to=bp_logo_directory_path)
    email = models.EmailField(blank=True, null=True)
    latitude = models.DecimalField(max_digits=5,
                                   decimal_places=2,
                                   blank=True,
                                   null=True)
    longitude = models.DecimalField(max_digits=5,
                                    decimal_places=2,
                                    blank=True,
                                    null=True)
    lat = models.FloatField(blank=True, null=True)
    lon = models.FloatField(blank=True, null=True)
    geom = models.PointField(srid=4326, blank=True, null=True)
    public_endpoint = models.URLField(blank=True, null=True)
    country = models.CharField(max_length=30, blank=True)
    objects = GeoManager()

    def __str__(self):
        return self.account_name
예제 #16
0
class createPet(models.Model):
    owner = models.ForeignKey(User,
                              related_name="pets",
                              null=True,
                              on_delete=models.CASCADE)
    owner_name = models.CharField(max_length=255)
    owner_image = models.CharField(max_length=255)
    owner_phone = models.CharField(max_length=255)
    pet_name = models.CharField(max_length=255)
    pet_category = models.CharField(max_length=255)
    amount = models.CharField(max_length=255)
    description = models.CharField(max_length=500)
    age = models.CharField(max_length=255, blank=True)
    location = models.CharField(max_length=500)
    latitude = models.CharField(max_length=500)
    longitude = models.CharField(max_length=500)
    coordinates = models.PointField(default=Point(0.0, 0.0))
    transportation = models.BooleanField(default=False)
    saled = models.BooleanField(null=True, blank=True)
    photo1 = models.FileField(upload_to='media/dp', blank=True)
    photo2 = models.FileField(upload_to='media/dp', blank=True)
    photo3 = models.FileField(upload_to='media/dp', blank=True)
    photo4 = models.FileField(upload_to='media/dp', blank=True)
    video = models.FileField(upload_to='videos/', blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.pet_name
예제 #17
0
class Main_Office(models.Model):
    name = models.CharField(max_length=50)
    location = models.PointField(srid=4326)
    address = models.CharField(max_length=80)

    def __str__(self):
        return self.name
예제 #18
0
class Biz(models.Model):
    uuid = models.UUIDField(default=uuid.uuid4, editable=False)
    title = models.CharField(max_length=200)
    description = models.TextField()
    address = models.CharField(max_length=255, blank=True)
    city = models.CharField(max_length=100)
    phone = PhoneNumberField()
    phone2 = models.CharField(validators=[phone2_regex],
                              max_length=17,
                              null=True,
                              blank=True)
    gallery = models.ImageField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    location = models.PointField(blank=True, null=True)
    website = models.URLField(max_length=50, blank=True, null=True)
    instagram = models.CharField(validators=[instagram_regex],
                                 max_length=255,
                                 blank=True,
                                 null=True)
    telegram = models.CharField(validators=[telegram_regex],
                                max_length=255,
                                blank=True,
                                null=True)
    is_claimed = models.BooleanField(default=False)
    claimed_by = models.ForeignKey(User,
                                   on_delete=models.SET_NULL,
                                   null=True,
                                   blank=True,
                                   default=None)
예제 #19
0
class Spatial_cluster_results(Common_EffortInstance_Info):

    #effort_instance = models.ForeignKey(EffortInstance, blank=True, null=True)
    effort_instance_id = models.IntegerField(primary_key=False)

    provider_name = models.CharField(max_length=500)

    nearby_points = models.IntegerField(primary_key=False,
                                        blank=True,
                                        null=True)
    point_checked = models.NullBooleanField(primary_key=False, blank=True)

    latitude = models.CharField(max_length=15, blank=True, null=True)
    longitude = models.CharField(max_length=15, blank=True, null=True)

    #overriding the default manager with a GeoManager instance.
    geom = models.PointField(dim=3, geography=True, blank=True, null=True)
    objects = models.GeoManager()

    def save(self):
        if self.latitude != None and len(self.latitude) > 0:
            lString = 'POINT(%s %s)' % (self.longitude.strip(),
                                        self.latitude.strip())
            self.point = fromstr(lString)
        super(Spatial_cluster_results, self).save()
예제 #20
0
파일: models.py 프로젝트: magservel/eBloc
class Line(models.Model):

    calques_choices = [
        (0, 'UNKNOWN'),
        (1, 'FACILE'),
        (2, 'DIFFICILE'),
        (3, 'ASSEZ_DIFFICILE'),
        (4, 'TRES_DIFFICILE'),
        (5, 'EXTREMEMENT_DIFFICILE'),
    ]
    line_info = models.ForeignKey(LineInfo,
                                  on_delete=models.CASCADE,
                                  null=True)
    line_nb = models.IntegerField(default=0)
    cota = models.CharField(max_length=10, blank=True)
    calque = models.IntegerField(choices=calques_choices, default=0)
    geom = models.PointField(null=True)
    objects = GeoManager()
    name = models.CharField(max_length=100, blank=True)
    bloc = models.ForeignKey(Bloc, on_delete=models.CASCADE, null=True)

    @property
    def printInfo(self):
        html = self.name
        return print_info_gen(html)
예제 #21
0
class FocoWFABBA(models.Model):
    dataUTC = models.DateTimeField()
    dataregUTC = models.DateTimeField()
    arquivo = models.CharField(max_length=100)
    posicao = models.PointField()
    Satzen = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    PixSize = models.DecimalField(default=0, decimal_places=4, max_digits=16)
    T4 = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    T11 = models.DecimalField(default=0, decimal_places=2, max_digits=16)
    FireSize = models.DecimalField(default=0, decimal_places=4, max_digits=16)
    Temp = models.IntegerField(default=0)
    FRP = models.IntegerField(default=0)
    Ecosystem = models.IntegerField(default=0)
    FireFlag = models.IntegerField(default=0)
    objects = models.GeoManager()

    @property
    def geom(self):
        return self.posicao

    class Meta:
        ordering = [
            'dataUTC',
        ]

    def __unicode__(self):
        return u'{0}'.format(self.dataUTC)
예제 #22
0
class PartnerSite(models.Model):
    geom = models.PointField(null=True, blank=True)
    name = models.CharField(max_length=200, blank=True)
    organization = models.ManyToManyField('PartnerOrganization', blank=True)
    contact = models.ManyToManyField('Person', blank=True)
    haverford_office = models.ManyToManyField('HaverfordOffice', blank=True)
    description = RichTextUploadingField(blank=True)
    start_date = models.DateField(blank=True, null=True)
    end_date = models.DateField(blank=True, null=True)
    type_of_opportunity = models.ManyToManyField('TypeOfOpportunity',
                                                 blank=True)
    area_of_interest = models.ManyToManyField('AreaOfInterest', blank=True)
    language = models.ManyToManyField('Language', blank=True)
    region = models.ManyToManyField('Region', blank=True)
    subject = models.ManyToManyField('Subject', blank=True)
    keywords = models.ManyToManyField('Keyword', blank=True)

    @property
    def popupContent(self):
        if self.contact.first():

            return '<br><b>{}</b><br><p>{}</p><br><p>Contact: <a href="mailto:{}">{}</a></p>{}'.format(
                self.name,
                self.description,
                self.contact.first().email,
                self.contact.first().name,
                self.contact.first().profile,
            )
        else:
            return '<br><b>{}</b><br><p>{}</p>'.format(self.name,
                                                       self.description)

    def __str__(self):
        return self.name
예제 #23
0
class Etablissements(models.Model):
    cycle_choices= (
    ( "Primaire","Primaire"),
    ("College","College"),
    ("Lycee","Lycee"),
    ("Université","Université")
)
    type_choices=(
    ("Public","Public"),
    ("Privé","Privé")

    )

    Nom= models.CharField(max_length=50)
    geom= models.PointField(srid=4326, blank= True,default=None)
    Cycle= models.CharField(max_length=200, choices= cycle_choices,null=False,default="Not selected" )
    Type= models.CharField(max_length=200, choices= type_choices,null=False,default="Not selected")
    Adress= models.CharField(max_length=200,default="Taroudant")
    Effectif_total= models.IntegerField(null=True,default=0)
    Nombre_Enseignant= models.IntegerField(null=True,default=0)
    Superficie= models.IntegerField(null=True,default=0)
    Latitude = models.FloatField(max_length=8,default=30)
    Longitude = models.FloatField(max_length=8,default=-8)

    object= GeoManager()

    def save(self, *args, **kwargs):
         self.Latitude  = self.geom.y
         self.Longitude = self.geom.x
         super(Etablissements, self).save(*args, **kwargs)
예제 #24
0
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
    bio = models.TextField(max_length=500, blank=True)
    location = models.CharField(max_length=30, blank=True)
    birth_date = models.DateField(null=True, blank=True)
    email_confirmed = models.BooleanField(default=False)

    profile_pic = models.ImageField(
        upload_to="profile_pics/",
        default="/media/profile_pics/placeholder_profile_pic.png",
    )
    location = models.PointField(null=True)
    lat = models.DecimalField(max_digits=10, decimal_places=6, default=0.0)
    lng = models.DecimalField(max_digits=10, decimal_places=6, default=0.0)

    address = models.CharField(max_length=300, blank=True)
    district = models.CharField(max_length=30, blank=True)
    city = models.CharField(max_length=30, blank=True)
    state = models.CharField(max_length=30, blank=True)
    country = models.CharField(max_length=30, blank=True)
    zip_code = models.IntegerField(blank=True, default=0, null=True)
    phone_number = models.CharField(max_length=20, null=True, blank=True)

    help_type = models.CharField(max_length=30, choices=HELP_TYPE, null=True)
    help_text = models.TextField(null=True)

    def set_location(self):
        self.location = Point(int(self.lng), int(self.lat), srid=4326)

    def __str__(self):
        return self.user.username
예제 #25
0
class emergencycall(models.Model):
    id = models.PositiveIntegerField(primary_key=True)
    received = models.DateTimeField()
    sent = models.DateTimeField()
    priority = models.IntegerField(null=True)
    description = models.CharField(max_length=50)
    details = models.TextField()
    external_data = models.TextField(blank=True)
    place = models.CharField(max_length=50, blank=True)
    address = models.TextField()
    unit = models.TextField(blank=True)
    cross_street = models.TextField(blank=True)
    city = models.TextField(blank=True)
    state = models.TextField(blank=True)
    source = models.TextField(blank=True)
    units = models.CharField(max_length=25, blank=True)
    cad_code = models.CharField(max_length=25, blank=True)
    messages = models.TextField(blank=True)
    responses = models.TextField(blank=True)
    agency = models.ForeignKey(agency, default=None, on_delete=models.CASCADE)
    lat = models.FloatField()
    lon = models.FloatField()
    point = models.PointField(geography=True, default='POINT(0.0 0.0)')

    def __str__(self):
        return self.description
예제 #26
0
class Tasks(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100)
    objectives = models.CharField(max_length=100)
    tasktype = models.ForeignKey(Tasktype)
    task_no = models.CharField(max_length=50, unique=True)
    project = models.ForeignKey(Projects)
    task_area = models.CharField(max_length=50, null=True, blank=True)
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()
    description = models.TextField(max_length=256, null=True, blank=True)
    team = models.ManyToManyField(Teams, through='Teamship', blank=True)
    manager = models.ForeignKey(Members, null=True, blank=True)
    location = models.PointField(srid=21037, null=True, blank=True)
    reports = models.FileField(upload_to=upload_taskreports,
                               null=True,
                               help_text="Upload task reports",
                               blank=True)
    slug = models.SlugField(null=True, blank=True)

    def __unicode__(self):
        return self.name

    def save(self, *args, **kwargs):
        if not self.id:
            self.slug = slugify(self.name)

        super(Tasks, self).save(*args, **kwargs)

    class Meta:
        verbose_name = "Task"
        verbose_name_plural = "Tasks"
        managed = True
예제 #27
0
class Store(models.Model):
    name = models.CharField(max_length=50)
    tel = models.CharField(max_length=50, null=True)
    lat = models.FloatField(null=True)
    lng = models.FloatField(null=True)
    location = models.PointField(null=True, srid=4326)
    code = models.CharField(max_length=20)
    country = models.ForeignKey('Country',
                                on_delete=models.SET_NULL,
                                null=True)
    city = models.ForeignKey('City', on_delete=models.SET_NULL, null=True)
    district = models.ForeignKey('District',
                                 on_delete=models.SET_NULL,
                                 null=True)
    address1 = models.CharField(max_length=100)
    address2 = models.CharField(max_length=100)
    open_time = models.TimeField(null=True)
    close_time = models.TimeField(null=True)
    business_district = models.ForeignKey('BusinessDistrict',
                                          on_delete=models.SET_NULL,
                                          null=True)
    objects = GeoManager()

    class Meta:
        db_table = 'stores'
예제 #28
0
class GuideProfile(models.Model):
    user = models.OneToOneField(User,
                                on_delete=models.CASCADE,
                                related_name="guideprofile")
    profile_pic = models.TextField()
    is_tourist = models.BooleanField(default=False)
    rating = models.FloatField(default=0.0)
    bio = models.TextField()
    pricing = models.IntegerField(default=1000)
    earning = models.IntegerField(default=0)
    phone_number = PhoneNumberField()
    location = models.CharField(max_length=400)
    latitude = models.DecimalField(decimal_places=7, max_digits=15)
    longitude = models.DecimalField(decimal_places=7, max_digits=15)
    loc = models.PointField(blank=True,
                            geography=True,
                            default='POINT(0.0 0.0)')

    objects = models.Manager()

    def __str__(self):
        return self.user.username

    def save(self, *args, **kwargs):
        self.loc.y = self.latitude
        self.loc.x = self.longitude
        super(GuideProfile, self).save(*args, **kwargs)
예제 #29
0
class Boundary(SluggedModel):
    """
    A boundary object, such as a Ward or Neighborhood.
    """
    set = models.ForeignKey(
        BoundarySet,
        related_name='boundaries',
        help_text=
        'Category of boundaries that this boundary belongs, e.g. "Community Areas".'
    )
    kind = models.CharField(
        max_length=64,
        help_text=
        'A copy of BoundarySet\'s "singular" value for purposes of slugging and inspection.'
    )
    external_id = models.CharField(
        max_length=64,
        help_text=
        'The boundaries\' unique id in the source dataset, or a generated one.'
    )
    name = models.CharField(
        max_length=192,
        db_index=True,
        help_text='The name of this boundary, e.g. "Austin".')
    display_name = models.CharField(
        max_length=256,
        help_text=
        'The name and kind of the field to be used for display purposes.')
    metadata = JSONField(
        blank=True,
        help_text=
        'The complete contents of the attribute table for this boundary from the source shapefile, structured as json.'
    )
    shape = models.MultiPolygonField(
        srid=4269,
        help_text='The geometry of this boundary in EPSG:4269 projection.')
    simple_shape = models.MultiPolygonField(
        srid=4269,
        help_text=
        'The geometry of this boundary in EPSG:4269 projection and simplified to 0.0001 tolerance.'
    )
    centroid = models.PointField(
        srid=4269,
        null=True,
        help_text=
        'The centroid (weighted center) of this boundary in EPSG:4269 projection.'
    )

    objects = models.GeoManager()

    class Meta:
        ordering = ('kind', 'display_name')
        verbose_name_plural = 'boundaries'

    def __unicode__(self):
        """
        Print names are formatted like "Austin Community Area"
        and will slug like "austin-community-area".
        """
        return unicode(self.display_name)
예제 #30
0
class Node(models.Model) :
    name=models.TextField()
    location = models.PointField(srid=4326)
    objects=models.GeoManager()

    def __unicode__(self):
        return self.name