Exemplo n.º 1
0
class Article(models.Model):
    title = models.CharField(max_length =60)
    post = models.TextField()
    editor = models.ForeignKey(Editor)
    tag = models.ManyToManyField(tag)
    pub_date = models.DateTimeField(auto_now_add=True)
    article_image = models.ImageField(upload_to = 'articles/')

    @classmethod
    def today_news(cls):
        today = dt.date.today()
        news = cls.objects.filter(pub_date__date = today)
        return news


    @classmethod
    def days_news(cls,date):
        news = cls.objects.filter(pub_date__date = date)
        return news

    @classmethod
    def search_by_title(cls,search_term):
        news = cls.objects.filter(title__icontains=search_term)
        return news
Exemplo n.º 2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='DroneFootage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.CharField(max_length=80)),
                ('datetime', models.DateTimeField()),
                ('title', models.CharField(max_length=500)),
                ('description', models.TextField()),
                ('post', models.TextField()),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('published', models.BooleanField(default=False)),
                ('droneImage', models.ImageField(blank=True, null=True, upload_to='drone_images')),
                ('droneVideo', models.FileField(upload_to='drone_videos')),
            ],
        ),
    ]
Exemplo n.º 3
0
class Course(models.Model):
    DEGREE_CHOICES = (
        ("cj", "初级"),
        ("zj", "中级"),
        ("gj", "高级")
    )
    name = models.CharField("课程名",max_length=50)
    desc = models.CharField("课程描述",max_length=300)
    detail = models.TextField("课程详情")
    degree = models.CharField('难度',choices=DEGREE_CHOICES, max_length=2)
    learn_times = models.IntegerField("学习时长(分钟数)",default=0)
    students = models.IntegerField("学习人数",default=0)
    fav_nums = models.IntegerField("收藏人数",default=0)
    image = models.ImageField("封面图",upload_to="courses/%Y/%m",max_length=100)
    click_nums = models.IntegerField("点击数",default=0)
    add_time = models.DateTimeField("添加时间",default=datetime.now,)
    course_org = models.ForeignKey(CourseOrg, on_delete=models.CASCADE, verbose_name="所属机构", null=True, blank=True)

    class Meta:
        verbose_name = "课程"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
Exemplo n.º 4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=120)),
                ('slug', models.SlugField(max_length=120, unique=True)),
                ('image', models.ImageField(upload_to='posts')),
                ('content', models.TextField()),
                ('draft', models.BooleanField(default=False)),
                ('updated', models.DateField(auto_now=True)),
                ('published', models.DateField(auto_now_add=True)),
                ('user', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Exemplo n.º 5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='information',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('info_title', models.CharField(max_length=150)),
                ('info', models.TextField()),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('added_by', models.CharField(max_length=100)),
                ('project_title', models.CharField(max_length=150)),
                ('project_description', models.TextField()),
                ('source_code', models.URLField()),
                ('webpage', models.URLField(blank=True, null=True)),
                ('image', models.ImageField(blank=True, height_field='height_field', null=True, upload_to='', width_field='width_field')),
                ('height_field', models.IntegerField(default=0)),
                ('width_field', models.IntegerField(default=0)),
                ('developing_or_developed', models.BooleanField(default=0)),
                ('key', models.CharField(max_length=100)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
        ),
    ]
Exemplo n.º 6
0
class Migration(migrations.Migration):

    dependencies = [
        ('gallery', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='picture',
            name='title',
            field=models.CharField(default='', help_text='必填,图片标题', max_length=20),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name='picture',
            name='alt',
            field=models.CharField(blank=True, help_text='选填,当图片无法显示时,显示的文字信息', max_length=20, null=True),
        ),
        migrations.AlterField(
            model_name='picture',
            name='image',
            field=models.ImageField(help_text='必填,上传图片', max_length=200, upload_to='gallery/', verbose_name='图片'),
        ),
    ]
Exemplo n.º 7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item_number', models.CharField(max_length=8, unique=True)),
                ('name', models.CharField(max_length=50)),
                ('description', models.TextField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('is_new', models.BooleanField()),
                ('size', models.CharField(max_length=40)),
                ('instructions', models.TextField()),
                ('featured_photo', models.ImageField(upload_to='')),
                ('category', models.CharField(choices=[('beds', 'Beds & mattressess'), ('furn', 'Furniture, wardrobes & shelves'), ('sofa', 'Sofas & armchairs'), ('table', 'Tables & chairs'), ('texti', 'Textiles'), ('deco', 'Decoration & mirrors'), ('light', 'Lighting'), ('cook', 'Cookware'), ('tablw', 'Tableware'), ('taps', 'Taps & sinks'), ('org', 'Organisers & storage accesories'), ('toys', 'Toys'), ('leis', 'Leisure'), ('safe', 'safety'), ('diy', 'Do-it-yourself'), ('floor', 'Flooring'), ('plant', 'Plants & gardering'), ('food', 'Food & beverages')], max_length=5)),
            ],
        ),
    ]
Exemplo n.º 8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Servicios',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('titulo', models.CharField(max_length=50)),
                ('contenido', models.CharField(max_length=50)),
                ('imagen', models.ImageField(upload_to='')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'servicio',
                'verbose_name_plural': 'servicios',
            },
        ),
    ]
Exemplo n.º 9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('content', models.TextField()),
                ('created_date', models.DateTimeField(auto_now_add=True)),
                ('published_date', models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True)),
                ('views', models.IntegerField(default=0)),
                ('tag', models.CharField(blank=True, max_length=30, null=True)),
                ('image', models.ImageField(blank=True, null=True, upload_to='images')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='posts', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Exemplo n.º 10
0
class Migration(migrations.Migration):

    dependencies = [
        ('mobile_delivery', '0001_initial'),
    ]

    operations = [
        migrations.RenameField(
            model_name='clearorders',
            old_name='Name_Other',
            new_name='Name_other',
        ),
        migrations.AlterField(
            model_name='clearorders',
            name='Signature',
            field=models.ImageField(
                blank=True, upload_to='media/mobile/delivery/signatures'),
        ),
        migrations.AlterField(
            model_name='clearorders',
            name='SystemDate',
            field=models.DateTimeField(auto_now=True),
        ),
    ]
Exemplo n.º 11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('seller', models.CharField(max_length=255)),
                ('date_posted', models.DateTimeField(auto_now_add=True)),
                ('title', models.CharField(max_length=255)),
                ('content', models.TextField(blank=True, null=True)),
                ('img_src',
                 models.ImageField(blank=True, null=True, upload_to='')),
            ],
        ),
    ]
Exemplo n.º 12
0
class Migration(migrations.Migration):

    dependencies = [
        ('Buyer', '0004_order'),
    ]

    operations = [
        migrations.CreateModel(
            name='OrderGoods',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('goods_id', models.IntegerField()),
                ('goods_name', models.CharField(max_length=32)),
                ('goods_price', models.FloatField()),
                ('goods_num', models.IntegerField()),
                ('goods_picture', models.ImageField(upload_to='images')),
                ('order', models.ForeignKey(on_delete=True, to='Buyer.Order')),
            ],
        ),
    ]
Exemplo n.º 13
0
class Migration(migrations.Migration):

    dependencies = [
        ('map_locations', '0009_auto_20191228_2010'),
    ]

    operations = [
        migrations.CreateModel(
            name='TripImages',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image', models.ImageField(upload_to='trip_pics/')),
                ('upload_date', models.DateTimeField(auto_now=True)),
                ('trip',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='trip_photos',
                                   to='map_locations.Trips')),
            ],
        ),
    ]
Exemplo n.º 14
0
class Country(models.Model):
    name = models.CharField(max_length=50, unique=True)
    image = models.ImageField(upload_to='countries/%Y/%m/%d/', null=True, blank=True)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

    def get_local_producers(self):
        regions = Region.objects.filter(country=self.pk)
        local_producers = Producer.objects.filter(origin__in=regions)
        return local_producers

    def get_local_wines(self):
        regions = Region.objects.filter(country=self.pk)
        local_wines = Wine.objects.filter(origin__in=regions)
        return local_wines

    def get_local_grapes(self):
        regions = Region.objects.filter(country=self.pk)
        local_grapes = Grape.objects.filter(origin__in=regions)
        return local_grapes

    def get_average_rating(self):
        """ Returns the consolidated average review rating for a country's
        wines (including every review for each of its vintages). """
        regions = Region.objects.filter(country=self.pk)
        wines = Wine.objects.filter(origin__in=regions)
        average_rating = Review.objects.filter(wine__in=wines).aggregate(Avg('score'))['score__avg']
        if average_rating:
            return round(average_rating, 1)
        return None

    class Meta:
        ordering = ('name',)

    def __str__(self):
        return self.name
Exemplo n.º 15
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Photo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('photo', models.ImageField(default='photos/no_image.png', upload_to='photo/%Y/%m/%d')),
                ('text', models.TextField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user-photos+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-updated'],
            },
        ),
    ]
Exemplo n.º 16
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('realtors', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('address', models.CharField(max_length=200)),
                ('city', models.CharField(max_length=100)),
                ('state', models.CharField(max_length=100)),
                ('zipcode', models.CharField(max_length=20)),
                ('description', models.TextField(blank=True)),
                ('price', models.IntegerField()),
                ('bedrooms', models.IntegerField()),
                ('bathrooms', models.DecimalField(decimal_places=1, max_digits=2)),
                ('garage', models.IntegerField(default=0)),
                ('sqft', models.IntegerField()),
                ('lot_size', models.DecimalField(decimal_places=1, max_digits=5)),
                ('photo_main', models.ImageField(upload_to='photos/%Y/%m/%d/')),
                ('photo_1', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_2', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_3', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_4', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_5', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_6', models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('is_published', models.BooleanField(default=True)),
                ('list_date', models.DateTimeField(blank=True, default=datetime.datetime.now)),
                ('realtor', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='realtors.Realtor')),
            ],
        ),
    ]
Exemplo n.º 17
0
class Migration(migrations.Migration):

    dependencies = [
        ('radiovis', '0005_auto_20210407_2209'),
    ]

    operations = [
        migrations.AddField(
            model_name='image',
            name='image112',
            field=models.ImageField(default='unavailable', upload_to='scaled'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='image',
            name='image128',
            field=models.ImageField(default='unavailable', upload_to='scaled'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='image',
            name='image32',
            field=models.ImageField(default='unavailable', upload_to='scaled'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='image',
            name='image320',
            field=models.ImageField(default='unavailable', upload_to='scaled'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='image',
            name='image600',
            field=models.ImageField(default='unavailable', upload_to='scaled'),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name='image',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
    ]
Exemplo n.º 18
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('officials', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Announcement',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('date',
                 models.DateTimeField(blank=True,
                                      default=datetime.datetime.now)),
                ('location', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('photo_main',
                 models.ImageField(upload_to='photos/%Y/%m/%d/')),
                ('photo_1',
                 models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_2',
                 models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_3',
                 models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_4',
                 models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('photo_5',
                 models.ImageField(blank=True, upload_to='photos/%Y/%m/%d/')),
                ('is_published', models.BooleanField(default=True)),
                ('official',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='officials.Official')),
            ],
        ),
    ]
Exemplo n.º 19
0
class Migration(migrations.Migration):

    dependencies = [
        ('journal', '0003_pinnedarticle'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='pinnedarticle',
            options={'ordering': ('sequence',)},
        ),
        migrations.AlterField(
            model_name='issue',
            name='cover_image',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.cover_images_upload_path),
        ),
        migrations.AlterField(
            model_name='issue',
            name='large_image',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.issue_large_image_path),
        ),
        migrations.AlterField(
            model_name='journal',
            name='default_cover_image',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.cover_images_upload_path),
        ),
        migrations.AlterField(
            model_name='journal',
            name='default_large_image',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.cover_images_upload_path),
        ),
        migrations.AlterField(
            model_name='journal',
            name='favicon',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.cover_images_upload_path),
        ),
        migrations.AlterField(
            model_name='journal',
            name='header_image',
            field=models.ImageField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location='/Users/ajrbyers/Code/janeway/src/media'), upload_to=journal.models.cover_images_upload_path),
        ),
    ]
Exemplo n.º 20
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=60)),
                ('slug', models.SlugField(blank=True, max_length=300, unique=True)),
                ('description', models.CharField(max_length=2000)),
            ],
        ),
        migrations.CreateModel(
            name='SubCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=60)),
                ('slug', models.SlugField(blank=True, max_length=300, unique=True)),
                ('description', models.CharField(max_length=2000)),
                ('banner_xlarge', models.ImageField(upload_to='subcategory_banners')),
                ('banner_large', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('banner_nslarge', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('banner_normal', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('banner_medium', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('banner_small', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('banner_xsmall', models.ImageField(blank=True, upload_to='subcategory_banners')),
                ('created_date', models.DateField(auto_now_add=True)),
                ('featured', models.BooleanField(default=False)),
                ('category', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='store.Category')),
            ],
        ),
    ]
Exemplo n.º 21
0
class Migration(migrations.Migration):

    dependencies = [
        ('website', '0034_auto_20191201_2146'),
    ]

    operations = [
        migrations.AlterField(
            model_name='depart1',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='depart2',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='depart3',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='depart4',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='homeimage',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='opinion',
            name='image',
            field=models.ImageField(upload_to='images/'),
        ),
    ]
Exemplo n.º 22
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('password', models.CharField(max_length=100)),
                ('name', models.CharField(max_length=200)),
                ('email',
                 models.EmailField(max_length=254,
                                   primary_key=True,
                                   serialize=False)),
                ('phone',
                 models.CharField(
                     blank=True,
                     max_length=15,
                     validators=[
                         django.core.validators.RegexValidator(
                             message=
                             "Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.",
                             regex='^\\+?1?\\d{9,15}$')
                     ])),
            ],
        ),
        migrations.CreateModel(
            name='FoodItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=500)),
                ('cuisine', models.CharField(max_length=100)),
                ('course',
                 models.CharField(choices=[('s', 'Starter'),
                                           ('m', 'Main Course'),
                                           ('d', 'Desert')],
                                  max_length=1)),
                ('price', models.IntegerField()),
                ('availability_time', models.TimeField()),
                ('image', models.ImageField(upload_to=b'')),
            ],
        ),
        migrations.CreateModel(
            name='Restaurant',
            fields=[
                ('email',
                 models.EmailField(max_length=254,
                                   primary_key=True,
                                   serialize=False)),
                ('name', models.CharField(max_length=200)),
                ('address', models.TextField()),
                ('res_type',
                 models.CharField(choices=[('B', 'Bar'), ('R', 'Restaurant')],
                                  max_length=1)),
                ('cuisine', models.CharField(max_length=100)),
                ('rating',
                 models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'),
                                           ('4', '4'), ('5', '5')],
                                  max_length=1)),
                ('city', models.CharField(max_length=100)),
                ('phone',
                 models.CharField(
                     blank=True,
                     max_length=15,
                     validators=[
                         django.core.validators.RegexValidator(
                             message=
                             "Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.",
                             regex='^\\+?1?\\d{9,15}$')
                     ])),
                ('image', models.ImageField(upload_to=b'')),
            ],
        ),
        migrations.AddField(
            model_name='fooditem',
            name='resid',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='foodspark.Restaurant'),
        ),
    ]
Exemplo n.º 23
0
class Sell(models.Model):
    name=models.CharField(max_length=15)
    desc=models.CharField(max_length=299)
    price=models.CharField(max_length=5)
    image=models.ImageField(null=True,blank=True)
    phone=models.CharField(max_length=10)
Exemplo n.º 24
0
class Migration(migrations.Migration):

    dependencies = [
        ('int_shop', '0012_auto_20160615_1442'),
    ]

    operations = [
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='Text')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Sent')),
                ('sender', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
        ),
        migrations.CreateModel(
            name='MainMenu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=40, verbose_name='Title')),
                ('url', models.URLField(verbose_name='URL')),
                ('is_active', models.BooleanField(verbose_name='Is active')),
                ('order', models.IntegerField(default=0, verbose_name='Order')),
            ],
        ),
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('system_name', models.CharField(max_length=255, verbose_name='Slug')),
                ('subject', models.CharField(max_length=255, verbose_name='Subject')),
                ('template', models.CharField(max_length=255, verbose_name='Template')),
                ('email_template', models.TextField(verbose_name='Email Template')),
                ('sender', models.EmailField(max_length=254, verbose_name='Sender')),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('avatar', models.ImageField(default=None, null=True, upload_to=b'', verbose_name='Image')),
                ('birth_date', models.DateField(default=None, verbose_name='Date of Birth')),
                ('city', models.CharField(default=None, max_length=255, verbose_name='City')),
                ('country', models.CharField(default=None, max_length=255, verbose_name='Country')),
                ('address', models.TextField(default=None, verbose_name='Address')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
        ),
        migrations.CreateModel(
            name='WishList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.AddField(
            model_name='product',
            name='in_stock',
            field=models.IntegerField(default=0, verbose_name='In stock'),
        ),
        migrations.AddField(
            model_name='product',
            name='rating',
            field=models.IntegerField(default=0, verbose_name='Rating'),
        ),
        migrations.AddField(
            model_name='product',
            name='sales_count',
            field=models.IntegerField(default=0, verbose_name='Sold'),
        ),
        migrations.AddField(
            model_name='product',
            name='votes_count',
            field=models.IntegerField(default=0, verbose_name='Voted'),
        ),
        migrations.AddField(
            model_name='wishlist',
            name='product',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='int_shop.Product', verbose_name='Product'),
        ),
        migrations.AddField(
            model_name='wishlist',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'),
        ),
    ]
Exemplo n.º 25
0
class User(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(null=True, blank=True, unique=True)
    mobile_no = models.CharField(max_length=32, unique=True)
    mobile_no1 = models.CharField(max_length=32, null=True)
    first_name = models.CharField(max_length=64, blank=True)
    last_name = models.CharField(max_length=64, blank=True, null=True)
    user_type = models.ForeignKey('common.RespondentType', null=True, on_delete=models.SET_NULL)
    is_active = models.BooleanField(default=False)
    is_staff = models.BooleanField(default=False)
    is_superuser = models.BooleanField(default=False)
    secure_login_token = models.CharField(
        max_length=128, null=True, blank=True)
    email_verification_code = models.CharField(
        max_length=128, null=True, blank=True)
    sms_verification_pin = models.IntegerField(null=True, blank=True)
    is_email_verified = models.BooleanField(default=False)
    is_mobile_verified = models.BooleanField(default=False)
    dob = models.DateField(null=True, blank=True)
    source = models.CharField(max_length=50, null=True, blank=True)
    changed = models.DateTimeField(null=True, editable=False, auto_now=True)
    created = models.DateTimeField(
        null=True, editable=False, auto_now_add=True)
    opted_email = models.BooleanField(
        default=False, help_text="Opted in to receive emails")
    image = models.ImageField(upload_to='profile_pics', blank=True, null=True)
    about = models.TextField(blank=True, null=True)
    twitter_handle = models.CharField(max_length=255, blank=True, null=True)
    fb_url = models.URLField(blank=True, null=True)
    website = models.URLField(blank=True, null=True)
    photos_url = models.URLField(blank=True, null=True)
    youtube_url = models.URLField(blank=True, null=True)
    objects = UserManager()
    USERNAME_FIELD = 'mobile_no'

    def save(self, *args, **kwargs):
        if self.email == '':
            self.email = None

        return super(User, self).save(*args, **kwargs)

    def generate_sms_pin(self):
        pin = ''.join([str(random.choice(range(1, 9))) for i in range(5)])
        self.sms_verification_pin = int(pin)

    def get_sms_pin(self):
        return self.sms_verification_pin

    # This is specifically for Konnect to login without auth
    def generate_login_token(self):
        self.passwordless_login_token = uuid.uuid5().hex
        return self.passwordless_login_token

    def send_otp(self):
        msg = 'Your one time password for ILP is %s. Please enter this on our web page or mobile app to verify your mobile number.' % self.sms_verification_pin
        send_sms(self.mobile_no, msg)

    # This is specifically for Konnect to login without auth
    def generate_login_token(self):
        self.secure_login_token = uuid.uuid4().hex
        return self.secure_login_token

    def generate_email_token(self):
        self.email_verification_code = uuid.uuid4().hex

    def get_token(self):
        return Token.objects.get(user=self).key

    def get_short_name(self):
        return self.first_name or ''

    def get_full_name(self):
        return ' '.join(
            filter(None, [self.first_name, self.last_name])) or self.email

    def send_verification_email(self):
        self.generate_email_token()
        url = reverse(
            'user_email_verify') + '?token={token}&email={email}'.format(
            token=self.email_verification_code,
            email=self.email
        )

        context = {
            'user': self,
            'site_url': Site.objects.get_current().domain,
            'url': url
        }

        send_templated_mail(
            from_email=settings.EMAIL_DEFAULT_FROM,
            to_emails=[self.email],
            subject='Please verify your email address',
            template_name='register',
            context=context
        )

        self.save()

    def __unicode__(self):
        return self.mobile_no

    class Meta:
        ordering = ['id', ]
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Identity',
            fields=[
                ('employee_id',
                 models.CharField(max_length=32,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True)),
                ('social_id',
                 models.CharField(blank=True,
                                  max_length=24,
                                  null=True,
                                  unique=True)),
                ('health_id',
                 models.CharField(blank=True,
                                  max_length=24,
                                  null=True,
                                  unique=True)),
                ('housing_id',
                 models.CharField(blank=True,
                                  max_length=24,
                                  null=True,
                                  unique=True)),
                ('tax_id',
                 models.CharField(blank=True,
                                  max_length=24,
                                  null=True,
                                  unique=True)),
            ],
            options={
                'verbose_name_plural': 'Identities',
            },
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('employee_id',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     primary_key=True,
                     serialize=False,
                     to='human.identity')),
                ('email',
                 models.EmailField(blank=True, max_length=254, null=True)),
                ('mobile',
                 models.CharField(blank=True, max_length=32, null=True)),
                ('address00',
                 models.CharField(max_length=128,
                                  verbose_name='Apt# and Street')),
                ('address01',
                 models.CharField(max_length=128,
                                  verbose_name='Purok, Sitio, or Village')),
                ('address02',
                 models.CharField(max_length=128, verbose_name='Barangay')),
                ('address03',
                 models.CharField(max_length=128, verbose_name='Locality')),
                ('address04',
                 models.CharField(max_length=128, verbose_name='Province')),
                ('address05',
                 models.CharField(choices=[
                     ('Ilocos Region', 'REG-I'),
                     ('Cagayan Valley Region', 'REG-II'),
                     ('Cordillera Administrative Region', 'CAR'),
                     ('Central Luzon Region', 'REG-I'),
                     ('National Capital Region', 'NCR'),
                     ('Calabarzon Region', 'REG-IVA'),
                     ('Mimaropa Region', 'REG-IVB'), ('Bicol Region', 'REG-V'),
                     ('Western Visayas Region', 'REG-VI'),
                     ('Central Visayas Region', 'REG-VII'),
                     ('Eastern Visayas Region', 'REG-VIII'),
                     ('Zamboanga Peninsula Region', 'REG-IX'),
                     ('Norther Mindanao Region', 'REG-X'),
                     ('Davao Region', 'REG-XI'), ('Soccsksargen', 'REG-XII'),
                     ('Caraga Region', 'REG-XIII'),
                     ('Bangsamoro Autonomous Region in Muslim Mindanao',
                      'BARMM')
                 ],
                                  max_length=128,
                                  verbose_name='Region')),
            ],
        ),
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('employee_id',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     primary_key=True,
                     serialize=False,
                     to='human.identity')),
                ('last_name', models.CharField(max_length=64)),
                ('first_name', models.CharField(max_length=64)),
                ('middle_name', models.CharField(max_length=64)),
                ('gender',
                 models.CharField(choices=[('Male', 'M'), ('Female', 'F')],
                                  default='',
                                  max_length=12)),
            ],
        ),
        migrations.CreateModel(
            name='Record',
            fields=[
                ('employee_id',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     primary_key=True,
                     serialize=False,
                     to='human.identity')),
                ('photo',
                 models.ImageField(
                     blank=True,
                     null=True,
                     upload_to='enterprise/src/assets/human/photos/')),
                ('position',
                 models.CharField(blank=True, max_length=64, null=True)),
                ('department',
                 models.CharField(blank=True, max_length=64, null=True)),
                ('started', models.DateField(blank=True, null=True)),
                ('ended', models.DateField(blank=True, null=True)),
            ],
        ),
    ]
Exemplo n.º 27
0
class Banner(models.Model):
    id = models.AutoField(primary_key=True)
    img = models.ImageField(upload_to='banner/', blank=True, null=True)
    type = models.IntegerField(blank=True, null=True)
    index = models.IntegerField(blank=True, null=True)
Exemplo n.º 28
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first', models.CharField(max_length=100)),
                ('last', models.CharField(max_length=100)),
                ('img', models.ImageField(default='enviro.png', upload_to='')),
                ('email', models.EmailField(blank=True, max_length=200)),
                ('bio', models.TextField(blank=True, default='Save Earth!')),
                ('country', models.CharField(blank=True, max_length=200)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Recycle',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('filled_recycle',
                 models.IntegerField(choices=[(0, 0), (1, 1), (2, 2), (3, 3),
                                              (4, 4), (5, 5), (6, 6), (7, 7),
                                              (8, 8), (9, 9)],
                                     default=0)),
                ('user_recycle',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='trash.profile')),
            ],
        ),
        migrations.CreateModel(
            name='Reduce',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('filled_reduce',
                 models.IntegerField(choices=[(0, 0), (1, 1), (2, 2), (3, 3),
                                              (4, 4), (5, 5), (6, 6), (7, 7),
                                              (8, 8), (9, 9)],
                                     default=0)),
                ('user_reduce',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='trash.profile')),
            ],
        ),
        migrations.CreateModel(
            name='Reuse',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('filled_reuse',
                 models.IntegerField(choices=[(0, 0), (1, 1), (2, 2), (3, 3),
                                              (4, 4), (5, 5), (6, 6), (7, 7),
                                              (8, 8), (9, 9)],
                                     default=0)),
                ('user_reuse',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='trash.profile')),
            ],
        ),
        migrations.CreateModel(
            name='Text',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField(max_length=300)),
                ('recycle_a',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='trash.recycle')),
                ('reduce_a',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='trash.reduce')),
                ('reuse_a',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='trash.reuse')),
            ],
        ),
        migrations.CreateModel(
            name='PointWorth',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('points', models.IntegerField(default=0)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Level',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('number',
                 models.IntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4),
                                              (5, 5), (6, 6), (7, 7), (8, 8),
                                              (9, 9)],
                                     default=1)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='trash.profile')),
            ],
        ),
    ]
Exemplo n.º 29
0
class Migration(migrations.Migration):

    dependencies = [
        ('wagtailcore', '0028_merge'),
        ('images', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='customimage',
            name='collection',
            field=models.ForeignKey(
                related_name='+',
                default=wagtail.wagtailcore.models.get_root_collection_id,
                verbose_name='collection',
                to='wagtailcore.Collection'),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True,
                                       verbose_name='created at',
                                       db_index=True),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='file',
            field=models.ImageField(
                height_field='height',
                upload_to=wagtail.wagtailimages.models.get_upload_to,
                width_field='width',
                verbose_name='file'),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='height',
            field=models.IntegerField(verbose_name='height', editable=False),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='tags',
            field=taggit.managers.TaggableManager(to='taggit.Tag',
                                                  through='taggit.TaggedItem',
                                                  blank=True,
                                                  help_text=None,
                                                  verbose_name='tags'),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='title',
            field=models.CharField(max_length=255, verbose_name='title'),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='uploaded_by_user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.SET_NULL,
                blank=True,
                editable=False,
                to=settings.AUTH_USER_MODEL,
                null=True,
                verbose_name='uploaded by user'),
        ),
        migrations.AlterField(
            model_name='customimage',
            name='width',
            field=models.IntegerField(verbose_name='width', editable=False),
        ),
    ]
Exemplo n.º 30
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Carrinho',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('criado', models.DateTimeField(auto_now=True)),
                ('status', models.BooleanField(default=False)),
                ('total',
                 models.DecimalField(max_digits=8, null=True,
                                     decimal_places=2)),
                ('subtotal',
                 models.DecimalField(max_digits=8, decimal_places=2,
                                     default=0)),
                ('desconto',
                 models.DecimalField(max_digits=8, decimal_places=2,
                                     default=0)),
                ('user',
                 models.OneToOneField(to=settings.AUTH_USER_MODEL, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='EnderecoEntrega',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('endereco',
                 models.CharField(max_length=100, default='Rua Joaozinho')),
                ('numero', models.CharField(max_length=20, default='222')),
                ('bairro',
                 models.CharField(max_length=20, default='Vila Sao Joao')),
                ('estado', models.CharField(max_length=2, default='SP')),
                ('cep', models.CharField(max_length=9, default='12236-720')),
                ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ItemCarrinho',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('quantidade', models.PositiveIntegerField(default=1)),
                ('subtotal',
                 models.DecimalField(max_digits=8,
                                     decimal_places=2,
                                     default=1.0)),
                ('carrinho',
                 models.ForeignKey(to='venda.Carrinho', null=True,
                                   blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Pedido',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('tipo_pagamento',
                 models.IntegerField(choices=[(1, 'Boleto')], default=1)),
                ('data_pedido', models.DateTimeField(auto_now_add=True)),
                ('carrinho', models.ForeignKey(to='venda.Carrinho')),
            ],
        ),
        migrations.CreateModel(
            name='Produto',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('nome', models.CharField(max_length=150)),
                ('preco', models.DecimalField(max_digits=8, decimal_places=2)),
                ('descricao', models.TextField(null=True, blank=True)),
                ('foto',
                 models.ImageField(verbose_name='Foto',
                                   upload_to='media/fotos/')),
            ],
        ),
        migrations.CreateModel(
            name='UserEndereco',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('endereco',
                 models.CharField(max_length=100, default='Rua Zezinho')),
                ('numero', models.CharField(max_length=20, default='111')),
                ('bairro',
                 models.CharField(max_length=20, default='Vila Junina')),
                ('estado', models.CharField(max_length=2, default='SP')),
                ('tel', models.CharField(max_length=15,
                                         default='(11)9999-9999')),
                ('cep', models.CharField(max_length=9, default='12236-700')),
                ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='pedido',
            name='cobranca',
            field=models.ForeignKey(related_name='Cobranca',
                                    to='venda.UserEndereco'),
        ),
        migrations.AddField(
            model_name='pedido',
            name='entrega',
            field=models.ForeignKey(related_name='Entrega',
                                    to='venda.EnderecoEntrega'),
        ),
        migrations.AddField(
            model_name='pedido',
            name='user',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL,
                                    null=True,
                                    blank=True),
        ),
        migrations.AddField(
            model_name='itemcarrinho',
            name='produto',
            field=models.ForeignKey(to='venda.Produto'),
        ),
    ]