Ejemplo n.º 1
0
class custom_user(AbstractUser):
    # 1 -> aluno
    # 2 -> motorista
    permissao = models.IntegerField(default=2)
    telefone = models.CharField(max_length=50, default='1')
    local = LocationField(default=(1.2, 1.2),
                          null=False,
                          map_attrs={
                              "style": "mapbox://styles/mapbox/outdoors-v11",
                              "zoom": 13,
                              "center": [17.031645, 51.106715],
                              "cursor_style": 'pointer',
                              "marker_color": "red",
                              "rotate": False,
                              "geocoder": True,
                              "fullscreen_button": True,
                              "navigation_buttons": True,
                              "track_location_button": True,
                              "readonly": True,
                              "placeholder": "Pick a location on map below",
                          })
    data_nascimento = models.DateField(auto_now=False,
                                       auto_now_add=False,
                                       null=False,
                                       blank=False,
                                       default=timezone.now)
    email = models.EmailField(unique=True)
Ejemplo n.º 2
0
class Neighbourhood(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    hood_name = models.CharField(max_length = 50)   
    location = LocationField(map_attrs={"center": [36.82, -1.29], "marker_color": "blue"})
    address = AddressAutoHiddenField(blank=True)
    occupants_count = models.IntegerField(default=1)
    admin = models.ForeignKey(Admin_Profile,on_delete=models.CASCADE)

    def __str__(self):
        return self.hood_name 

    def create_hood(self):
        self.save()

    def delete_hood(self):
        self.delete()

    def update_hood(self):
        self.save()


    @classmethod
    def find_neigborhood(cls, neigborhood_id):
        pass

    @classmethod
    def update_occupants(cls):
        pass
Ejemplo n.º 3
0
class Facility(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    facility_name = models.CharField(max_length = 100) 
    category = models.CharField(max_length=50, choices=FACILITY_CHOICES, default='police')
    contact = models.CharField(max_length = 100, blank=True)
    location = LocationField(map_attrs={"center": [36.82, -1.29], "marker_color": "blue"})
    hood = models.ForeignKey(Neighbourhood,on_delete=models.CASCADE)
Ejemplo n.º 4
0
class Listing(models.Model):
  realtor = models.ForeignKey(Realtor, on_delete=models.DO_NOTHING)
  title = models.CharField(max_length=200)
  address = models.CharField(max_length=200)
  city = models.CharField(max_length=100, choices=city_model, default='Athens')
  region = models.CharField(max_length=100,choices=region_model,default='Attica')
  zipcode = models.CharField(max_length=20)
  location = LocationField(map_attrs={"center": [37,23], "marker_color": "blue"})
  geo_lat = models.DecimalField(decimal_places=10, default=0, max_digits=13)
  geo_lng = models.DecimalField(decimal_places=10, default=0, max_digits=13)
  description = NonStrippingTextField(blank=True)
  price = models.IntegerField()
  bedrooms = models.IntegerField()
  bathrooms = models.DecimalField(max_digits=2, decimal_places=1)
  garage = models.IntegerField(default=0)
  property_type = models.CharField(max_length=100, choices=property_type, default='House')
  sqft = models.IntegerField()
  photo_main = models.ImageField(upload_to='photos/%Y/%m/%d/')
  photo_1 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  photo_2 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  photo_3 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  photo_4 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  photo_5 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  photo_6 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
  is_published = models.BooleanField(default=True)
  is_for_sale = models.BooleanField(default=False)
  is_to_rent = models.BooleanField(default=False)
  list_date = models.DateTimeField(default=datetime.now, blank=True)  
  def __str__(self):
    return self.title
Ejemplo n.º 5
0
class Visite_test(models.Model):

    Titre = models.CharField(max_length=255)
    région = models.ForeignKey(Location, on_delete=models.CASCADE)
    wilaya = models.ForeignKey(Wilaya,
                               on_delete=models.SET_NULL,
                               null=True,
                               blank=True)
    localité = models.ForeignKey(Localité,
                                 on_delete=models.SET_NULL,
                                 null=True,
                                 blank=True)
    description = models.CharField(max_length=255, blank=True)
    localisation = LocationField(null=True, blank=True)
    date = models.DateField(null=True)
    modifiée_par = models.ForeignKey(User,
                                     on_delete=models.CASCADE,
                                     default=True)

    status_choice = (
        ('Planifiée', 'Planifiée'),
        ('Annulée', 'Annulée'),
        ('Changée', 'Changée'),
        ('Cloturée', 'Cloturée'),
    )
    status = models.CharField(choices=status_choice, max_length=10)

    class Meta:
        ordering = ["-date"]
Ejemplo n.º 6
0
class Business(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    business_name = models.CharField(max_length = 50) 
    short_description = models.CharField(max_length = 150) 
    business_email = models.EmailField() 
    location = LocationField(map_attrs={"center": [36.82, -1.29], "marker_color": "blue"})
    owner = models.ForeignKey(User,on_delete=models.CASCADE)
    hood = models.ForeignKey(Neighbourhood,on_delete=models.CASCADE)
Ejemplo n.º 7
0
class Map(models.Model):
    location = LocationField(
        map_attrs={
            "style": "mapbox://styles/mightysharky/cjwgnjzr004bu1dnpw8kzxa72",
            "center": (17.031645, 51.106715)
        })
    created_at = models.DateTimeField(auto_now_add=True)
    address = AddressAutoHiddenField()
Ejemplo n.º 8
0
class LocationPickerModel(models.Model):
    location = LocationField(
        map_attrs={
            "style": "mapbox://styles/mightysharky/cjwgnjzr004bu1dnpw8kzxa72",
            "center": [-91.5550, 41.6627],
            "marker_color": 'red'
        })
    radius = models.IntegerField()
    days = models.IntegerField()
Ejemplo n.º 9
0
class FindDonorForm(Form):
    search_location = LocationField(
        map_attrs={
            'track_location_button': True,
            'center': [76.9512635, 28.6923329],
            'readonly': True,
            'zoom': 4
        })
    blood_group = ChoiceField(choices=blood_group_choices, required=False)
Ejemplo n.º 10
0
class Location(models.Model):
    location = LocationField(
        map_attrs={
            "style": "mapbox://styles/mapbox/outdoors-v11",
            "marker_color": "blue",
            "center": (17.031645, 51.106715)
        })
    create = models.DateTimeField(auto_now_add=True)
    address = AddressAutoHiddenField()
Ejemplo n.º 11
0
class Resident_Profile(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    profile_photo = models.ImageField(upload_to = 'profilepics/', blank=True)
    username = models.CharField(max_length = 50) 
    full_name= models.CharField(max_length = 50)    
    bio = models.TextField(blank=True)
    this_user = models.ForeignKey(User,on_delete=models.CASCADE)
    hood = models.ForeignKey(Neighbourhood,on_delete=models.CASCADE)
    home_location = LocationField(map_attrs={"center": [36.82, -1.29], "marker_color": "blue"}, blank=True)

    def __str__(self):
        return self.full_name 
Ejemplo n.º 12
0
class Neighbourhood(models.Model):
    name = models.CharField(max_length=80)
    admin = models.ForeignKey(Admin, on_delete=models.CASCADE)
    occupants = models.IntegerField(default=1)
    location = LocationField(map_attrs={
        "center": [36.82, -1.29],
        "marker_color": "blue"
    })
    address = AddressAutoHiddenField(blank=True)

    def __str__(self):
        return self.name
Ejemplo n.º 13
0
class Occupant(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    name = models.CharField(max_length=90, default="Fullname")
    profile_pic = CloudinaryField('Profile Picture')
    neighbourhood = models.ForeignKey(Neighbourhood, on_delete=models.CASCADE)
    home = LocationField(map_attrs={
        "center": [36.82, -1.29],
        "marker_color": "blue"
    },
                         blank=True)

    def __str__(self):
        return self.user.username
Ejemplo n.º 14
0
class Location(models.Model):
    name = models.CharField(null=False, blank=False, max_length=255)

    description = models.TextField(null=False, blank=False)

    created_at = models.DateTimeField(auto_now_add=True)

    free = models.BooleanField(blank=False, null=False, default=False)

    coordinates = LocationField(
        map_attrs={
            "style": "mapbox://styles/mapbox/streets-v11",
            "center": (35.921637, -79.077887),
            "zoom": 5,
            "rotate": True,
            "navigation_buttons": True,
            "track_location_button": True,
            "id": "map",
        })  # this gets reversed when delivered with the api for some reason?

    address = AddressAutoHiddenField(map_id="map")

    class LocationTypeChoices(models.TextChoices):
        PARK = "PA", ("Dog Park")
        RESTAURANT = "RE", ("Restaurant")
        VET = "VE", ("Veterinarian")
        TRAIL = "TR", ("Trail")
        HOUSE = "HO", ("House")

    location_type = models.CharField(
        max_length=2,
        choices=LocationTypeChoices.choices,
        default=LocationTypeChoices.PARK,
        null=True,
        blank=True,
    )

    def __str__(self):
        def loc_type():
            if self.location_type == "HO":
                return "House"
            elif self.location_type == "PA":
                return "Park"
            elif self.location_type == "RE":
                return "Restaurant"
            elif self.location_type == "VE":
                return "Veterinarian"
            return "Trail"

        return f"{loc_type()} called '{self.name[:50]}'"
Ejemplo n.º 15
0
class Teacher(models.Model):
    user = models.OneToOneField(User,
                                on_delete=models.CASCADE,
                                primary_key=True)
    bio = models.TextField(max_length=500, blank=True)
    education_centre = models.CharField(max_length=255)
    location = LocationField(map_attrs={
        "center": [41.3, 69.26667],
        "marker_color": "blue"
    },
                             null=True,
                             blank=True)
    phone = models.CharField(max_length=30, default='')
    birth_date = models.DateField(null=True, blank=True)
    avatar = models.ImageField(upload_to='avatars/', null=True, blank=True)
Ejemplo n.º 16
0
class resources(models.Model):
    name = models.CharField(max_length=100)
    location = LocationField(map_attrs={
        "center": [0, 0],
        "marker_color": "blue"
    })
    address = AddressAutoHiddenField()
    pincode = models.CharField(max_length=50)
    work = models.CharField(max_length=100)
    email = models.EmailField()
    phone_number = models.CharField(max_length=12)

    def __str__(self):
        return "%s %s %s %s" % (self.name, self.work, self.location,
                                self.pincode)
Ejemplo n.º 17
0
class Business(models.Model):
    name = models.CharField(max_length=80)
    definition = models.CharField(max_length=300)
    email = models.EmailField()
    location = LocationField(map_attrs={
        "center": [36.82, -1.29],
        "marker_color": "blue"
    })
    neighbourhood = models.ForeignKey(Neighbourhood, on_delete=models.CASCADE)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "Businesses"
Ejemplo n.º 18
0
class SomeLocationModel(models.Model):
    location = LocationField(
        map_attrs={
            "zoom": 7,
            "center": [41.26848144933652, 69.22686929378176],
            "cursor_style": 'pointer',
            "marker_color": "red",
            "rotate": True,
            "geocoder": True,
            "fullscreen_button": True,
            "navigation_buttons": True,
            "track_location_button": True,
            "readonly": True,
            "placeholder": "Pick a location on map below",
        })
Ejemplo n.º 19
0
class Amenity(models.Model):
    name = models.CharField(max_length=80)
    category = models.CharField(max_length=50, choices=AMENITY_CHOICES)
    location = models.CharField(max_length=300)
    contact = models.CharField(max_length=100)
    location = LocationField(map_attrs={
        "center": [36.82, -1.29],
        "marker_color": "blue"
    })
    neighbourhood = models.ForeignKey(Neighbourhood, on_delete=models.CASCADE)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "Amenities"
Ejemplo n.º 20
0
class Lake(models.Model):
    name = models.CharField(max_length=100)
    fish_in_lake = models.ManyToManyField('Fish', related_name='lakes')
    food_safe = models.CharField(max_length=50)
    location = LocationField(map_attrs={'center': [0, 0]},
                             null=True,
                             blank=True)
    slug = models.SlugField(null=True, unique=True)
    lake_tag = models.ForeignKey("Tag",
                                 on_delete=models.CASCADE,
                                 null=True,
                                 blank=True)
    img = models.ImageField(default='default.png', upload_to='lake/')

    def __str__(self):
        return f'Lake: {self.name}'
Ejemplo n.º 21
0
class User(AbstractUser):
    is_verified = models.BooleanField(default=False)
    is_alumni = models.BooleanField(default=False)
    is_faculty = models.BooleanField(default=False)
    profile_photo = models.ImageField(upload_to=upload_user_image_location)
    profile_complete = models.BooleanField(default=0)
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    full_name = models.SlugField(editable=False)
    college = models.ForeignKey(College,
                                on_delete=models.SET_NULL,
                                null=True,
                                blank=True)
    course = models.ForeignKey(Course,
                               on_delete=models.SET_NULL,
                               null=True,
                               blank=True)
    department = models.ForeignKey(Department,
                                   on_delete=models.SET_NULL,
                                   null=True,
                                   blank=True)
    specialization = models.ForeignKey(Specialization,
                                       on_delete=models.SET_NULL,
                                       null=True,
                                       blank=True)
    dob = models.DateField(null=True, blank=True)
    system_date_joined = models.DateTimeField(verbose_name="Date Joined",
                                              auto_now=True)
    system_last_login = models.DateTimeField(verbose_name="Last Login",
                                             auto_now=True)
    email = models.EmailField(null=True, unique=True)
    facebook_profile = models.URLField(max_length=1000, null=True, blank=True)
    twitter_profile = models.URLField(max_length=1000, null=True, blank=True)
    linkedin_profile = models.URLField(max_length=1000, null=True, blank=True)
    location = LocationField(map_attrs={
        "center": (15.29, 74.12),
        "marker_color": "blue"
    })
    address = AddressAutoHiddenField()
    position = models.ForeignKey(Position,
                                 on_delete=models.SET_NULL,
                                 null=True,
                                 blank=True)
    phone = models.CharField(max_length=20, null=True, blank=True)
    about_me = models.TextField(null=True, blank=True)
Ejemplo n.º 22
0
class Visite_test (models.Model):

    Titre = models.CharField(max_length=255)
    région = models.ForeignKey(Location, on_delete=models.CASCADE)
    wilaya = models.ForeignKey(Wilaya, on_delete=models.SET_NULL, null=True)
    localité = models.ForeignKey(Localité, on_delete=models.SET_NULL, null=True)
    description = models.CharField(max_length=255)
    localisation = LocationField(null=True)
    date = models.DateField(null=True)

    status_choice = (
        ('En cours', 'En cours'),
        ('Annulée', 'Annulé'),

        ('Changée', 'Changé'),
        ('Cloturée', 'Cloturé'),
    )
    status = models.CharField(choices=status_choice, max_length=10)
Ejemplo n.º 23
0
class Trade(models.Model):

    #If you want to include a category with a space in it, you might need to
    #add a slug as one of their values is user as a url.
    CATEGORY_CHOICES = (
        ('art', 'Art'),
        ('books', 'Books'),
        ('clothes', 'Clothes'),
        ('electronics', 'Electronics'),
        ('furniture', 'Furniture'),
        ('toys', 'Toys'),
        ('other', 'Other'),
    )
    QUALITY_CHOICES = (
        ('new', 'New'),
        ('good', 'Good'),
        ('fair', 'Fair'),
        ('slightly-damaged', 'Slightly Damaged'),
        ('battle-scarred', 'Battle Scarred'),
    )

    NAME_MAX_LENGTH = 128

    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             default=None,
                             on_delete=models.CASCADE)
    name = models.CharField(max_length=NAME_MAX_LENGTH, unique=True)
    category = models.CharField(max_length=48, choices=CATEGORY_CHOICES)
    quality = models.CharField(max_length=48, choices=QUALITY_CHOICES)
    description = models.TextField(blank=False)
    suggested_trade = models.CharField(max_length=128, blank=False)
    location = LocationField(
        map_attrs={"center": [-4.28992174937531, 55.872480052801336]})
    slug = models.SlugField()
    date_made = models.DateTimeField(auto_now=True)

    #saves_count = models.IntegerField(default= 0 )

    def save(self, *args, **kwargs):
        self.slug = slugify(self.name)
        super(Trade, self).save(*args, **kwargs)

    def __str__(self):
        return self.name
Ejemplo n.º 24
0
class VendorProfile(models.Model):
    vendorName = models.CharField(verbose_name='Vendor Name', max_length=200)
    description = models.TextField(verbose_name='Description')
    phoneNumber = models.CharField(verbose_name='Phone Number',  max_length=20,blank=True, null=True)
    age = models.CharField(verbose_name='Age', max_length=2,blank=True, null=True)
    creator = models.ForeignKey(settings.AUTH_USER_MODEL,  null=True, default=None, on_delete=models.CASCADE)
    created_date = models.DateTimeField(default=timezone.now)
    vendorImg = models.ImageField(verbose_name="A picture of the vendor:", upload_to='upload/',null=True, default=None)
    categoryId = models.ForeignKey('vendorDetails.Category', verbose_name="What category of items does this vendor sell?", on_delete=models.CASCADE, related_name='profiles', default=None )
    location = LocationField()
    addressloc = models.CharField(max_length=2000000)
    zipcodeLoc= models.CharField(max_length=100)

    def publish(self):
        self.created_date = timezone.now()
        self.save()

    def __str__(self):
        return self.vendorName
Ejemplo n.º 25
0
class Carwash(models.Model):
    name = models.CharField(max_length=30)
    foundation_date = models.DateField()
    email = models.EmailField()
    photo = models.ImageField(blank=True, upload_to='CarwashImages', null=True)
    website = models.URLField()
    location = LocationField(
        blank=True,
        null=True,
        map_attrs={"center": (30.522366336674224, 50.45084688302083)})

    def __str__(self):
        return f'{self.name}'

    def get_order_stats(self):
        """returns number of orders for each day of last week from now as iterator"""
        return [
            Order.objects.filter(carwash=self).filter(
                order_date=dt.datetime.now() - dt.timedelta(days=i)).count()
            for i in range(6, -1, -1)
        ]
Ejemplo n.º 26
0
class Profile(models.Model):
    user = models.ForeignKey(Users,
                             related_name="user",
                             on_delete=models.CASCADE)
    profile_pic = models.CharField(max_length=255, null=True)
    location = LocationField(
        map_attrs={
            "style": "mapbox://styles/mightysharky/cjwgnjzr004bu1dnpw8kzxa72",
            "center": (-96.7969, 32.7763)
        })
    address = AddressAutoHiddenField()
    availability = models.CharField(max_length=50)
    deposit = models.IntegerField(default=0)
    walk_ins = models.BooleanField()
    is_apprentice = models.BooleanField()
    styles = models.ManyToManyField(Styles, related_name="artists_with_styles")
    followers = models.ManyToManyField(Users, related_name="favorite_artists")
    #users who follow artist profile
    #studios_joined = list of studios an artist has worked at.
    #contacts= list of contacts linked to a given profile
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
Ejemplo n.º 27
0
class Turma(models.Model):
    motorista = models.ForeignKey(
        custom_user,  on_delete=models.DO_NOTHING)
    alunos = models.ManyToManyField(
        custom_user, related_name='%(class)s_alunos')
    nome = models.CharField(max_length=100, default="")

    local = LocationField(default=(0, 0), null=False, map_attrs={
        "style": "mapbox://styles/mapbox/outdoors-v11",
        "zoom": 13,
        "center": [17.031645, 51.106715],
        "cursor_style": 'pointer',
        "marker_color": "red",
        "rotate": False,
        "geocoder": True,
        "fullscreen_button": True,
        "navigation_buttons": True,
        "track_location_button": True,
        "readonly": True,
        "placeholder": "Pick a location on map below", })

    def __str__(self):
        return f'{self.motorista} - {self.nome}'
Ejemplo n.º 28
0
class Place(models.Model):
    GRIETA = 1
    NORMAL = 2
    MORTAL = 3
    Danger = [
        (GRIETA, 'Grieta'),
        (NORMAL, 'Normal'),
        (MORTAL, 'Mortal'),
    ]

    location = LocationField(
        map_attrs={
            "style": "mapbox://styles/mapbox/streets-v11",
            "center": (-76.51972, 3.44),
            "marker_color": "DodgerBlue"
        })
    created_at = models.DateTimeField(auto_now_add=True)
    address = AddressAutoHiddenField()
    name = models.CharField(max_length=8)
    level = models.IntegerField(choices=Danger)
    users = models.ManyToManyField('Profile',
                                   related_name='places',
                                   blank=True)
Ejemplo n.º 29
0
class Impress(models.Model):
    """Модель описывающая впечатление"""
    name = models.CharField(max_length=255,
                            null=False,
                            verbose_name="Название воспоминания")
    info = models.TextField(null=True,
                            verbose_name="Инофрмация о воспоминании")
    date = models.DateTimeField(auto_now_add=True,
                                db_index=True,
                                verbose_name='Время')
    profile = models.ForeignKey(Profile,
                                on_delete=models.CASCADE,
                                verbose_name="Автор",
                                blank=True,
                                null=True)
    location = LocationField(map_attrs={
        "id": "unique_id_1",
        "center": [92.87172071992194, 56.00781904796429],
        "marker_color": "blue",
        "readonly ": True
    },
                             verbose_name="Место")
    address = AddressAutoHiddenField(map_id="unique_id_1")
Ejemplo n.º 30
0
class LocationFilterModel(models.Model):
    locationOfFilter=LocationField(map_attrs={"id": "unique_id_1"})
    locFilterAddress= models.CharField(max_length=2000000,null=True, default=None)
    locFilterZipcodeLoc = models.CharField(max_length=100,null=True, default="")