Esempio n. 1
0
class Product(models.Model):
    """Model for create product"""
    merchant = models.ForeignKey(Merchant, on_delete=models.CASCADE)
    product_name = models.CharField(max_length=255)
    product_description = models.TextField()
    product_image = models.ImageField(upload_to='images/products/')
    Technical_file = ArrayModelField(model_container=TechnicalFiles, null=True, blank=True)
    application_guidelines = ArrayModelField(model_container=AppilicationGuideLineFiles, null=True, blank=True)
    video = ArrayModelField(model_container=VideoFiles, null=True, blank=True)
    safety_data_sheet = ArrayModelField(model_container=SafetyFiles, null=True, blank=True)
    certificate = ArrayModelField(model_container=Certificate, null=True, blank=True)
    a_side_batch = models.CharField(max_length=255, blank=True, null=True)
    a_side_set_temperature = models.IntegerField(blank=True, null=True)
    b_side_set_temperature = models.IntegerField(blank=True, null=True)
    hot_set_temperature = models.IntegerField(blank=True, null=True)
    mixing_chamber_size = models.IntegerField(blank=True, null=True)
    pressure_set = models.IntegerField(blank=True, null=True)
    starting_drum_temperature = models.IntegerField(blank=True, null=True)
    qr_code_scan_reward = models.IntegerField(blank=True, null=True)
    a_side_batch_reward = models.IntegerField(blank=True, null=True)
    a_side_set_temp_reward = models.IntegerField(blank=True, null=True)
    b_side_set_temp_reward = models.IntegerField(blank=True, null=True)
    hot_set_temp_reward = models.IntegerField(blank=True, null=True)
    pressure_set_reward = models.IntegerField(blank=True, null=True)
    mixing_chamber_size_reward = models.IntegerField(blank=True, null=True)
    photo_of_install_foam_reward = models.IntegerField(blank=True, null=True)
    starting_drum_temperature_point_reward = models.IntegerField(blank=True, null=True)
    total_point = models.IntegerField(default=0)
    is_deleted = models.BooleanField(default=False)
class Post(models.Model):
    user = models.ForeignKey(Person, default=1, on_delete=models.SET_DEFAULT)
    description = models.CharField(max_length=500)
    likes = ArrayModelField(null=False, model_container=Like)
    comments = ArrayModelField(null=False, model_container=Comment)

    def __str__(self):
        return self.user.fullname
Esempio n. 3
0
class Serviceprovider(models.Model):
    token_id = models.CharField(max_length=255, null=True)
    full_name = models.CharField(max_length=25, null=False, blank=False)
    email = models.EmailField(
        max_length=30, null=False, blank=False, unique=True)
    password = models.CharField(max_length=255, null=False, blank=False)
    mobile = models.IntegerField(null=False, blank=False)
    services = ArrayModelField(model_container=ServiceList)
    applied_service = ArrayModelField(model_container=Appliedservice)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=False)
Esempio n. 4
0
class SlpUser(models.Model):
    """User model to save user details"""
    choices = (
        ('Block', 'Block'),
        ('Unblock', 'Unblock')
    )
    email = models.EmailField(max_length=255, unique=True, blank=False, null=False)
    password = models.CharField(max_length=20, blank=False, null=False)
    first_name = models.CharField(max_length=255, blank=False, null=False)
    last_name = models.CharField(max_length=255, blank=False, null=False)
    phone = models.CharField(max_length=10, blank=False, null=False)
    address = EmbeddedModelField(model_container=Address)
    company = models.CharField(max_length=255, blank=False, null=False)
    is_deleted = models.BooleanField(default=False)
    refer_code = models.CharField(max_length=255, unique=True)
    referred_by = models.CharField(max_length=255, blank=True, null=True)
    referred_to = ArrayModelField(model_container=ReferredUser, null=True, blank=True)
    status = models.CharField(max_length=20, choices=choices, default="Unblock")
    total_points = models.IntegerField(blank=False, null=False, default=0)
    available_points = models.IntegerField(blank=False, null=False, default=0)
    profile_photo = models.ImageField(upload_to='images/users')
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        """provides string representation of slp user model"""
        return self.first_name
Esempio n. 5
0
class Post(Model):
    title = CharField(max_length=255)
    slug = SlugField(unique=True)
    content = TextField()
    is_draft = BooleanField(default=True)
    is_archived = BooleanField(default=False)
    published = DateTimeField(null=True)

    authors = ManyToManyField(User)
    tags = ArrayModelField(model_container=Tag)

    created = DateTimeField(auto_now_add=True)
    updated = DateTimeField(auto_now=True)

    # cover_img
    # authors (multiple)
    # categories
    # tags
    # layout
    # allow_comments

    objects = DjongoManager()

    def __str__(self):
        return self.title

    class JSONAPIMeta:
        resource_name = "posts"
Esempio n. 6
0
class Appliedservice(models.Model):
    asid = models.IntegerField(null=False, blank=False)
    customer_id = models.IntegerField(null=False, blank=False)
    service_id = models.IntegerField(null=False, blank=False)
    comments = ArrayModelField(model_container=Appsercomment)
    status = models.CharField(max_length=25)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=True)
Esempio n. 7
0
class post(models.Model):
    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    image = models.ImageField(upload_to='photos/%Y/%m/%d', blank=True)
    content = models.CharField(max_length=140, validators=[validate_content], blank=True)
    updated = models.DateTimeField(default=datetime.now, blank=True)
    timestamp = models.DateTimeField(default=datetime.now, blank=True)
    comments = ArrayModelField(model_container=comment, null=True, blank=True)

    def __str__(self):
        return self.user.username
Esempio n. 8
0
class Customer(models.Model):
    token_id = models.CharField(max_length=255, null=True)
    user_name = models.CharField(max_length=30, blank=False, null=False)
    password = models.CharField(max_length=255, blank=False, null=False)
    email = models.EmailField(blank=False, null=False, unique=True)
    phone = models.IntegerField(null=False, blank=False)
    address = EmbeddedModelField(model_container=Address)
    services_requested = ArrayModelField(model_container=CustService)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=False)
Esempio n. 9
0
class Quiz(models.Model):
    """"Represents Quiz details in Table"""
    name = models.CharField(max_length=255, unique=True)
    video = models.ForeignKey(Video, on_delete=models.CASCADE)
    points = models.IntegerField()
    question = ArrayModelField(model_container=Question)
    is_deleted = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.name
Esempio n. 10
0
class ServiceList(models.Model):
    sid = models.IntegerField(null=False, blank=False)
    spid = models.IntegerField(null=False, blank=False)
    service_category = models.CharField(
        max_length=120, null=False, blank=False)
    service_name = models.CharField(max_length=120, null=False, blank=False)
    service_desc = models.CharField(max_length=255, null=False, blank=False)
    service_cost = models.IntegerField(null=False, blank=False)
    comments = ArrayModelField(model_container=CustComments)
    is_deleted = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=True)
Esempio n. 11
0
class comment(models.Model):
    def ids():
        no = comment.objects.count()
        if no == None:
            return 1
        else:
            return no + 1

    comment_id = models.IntegerField(default=ids, unique=True)
    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    messages = models.CharField(max_length=140, blank=True)
    time = models.DateTimeField(auto_now=True)
    no_of_like = models.IntegerField(blank=True)
    likes = ArrayModelField(model_container=like, null=True, blank=True)

    def __str__(self):
        return self.messages
class Comment(models.Model):
    cid = models.IntegerField()
    user = models.ForeignKey(Person, default=1, on_delete=models.SET_DEFAULT)
    comment = models.CharField(max_length=120)
    likes = ArrayModelField(null=False, model_container=Likecomments)