示例#1
0
class Image(models.Model):

    own_id = models.CharField(max_length=255)
    author = models.CharField(max_length=255)
    camera = models.CharField(max_length=255)
    tags = models.CharField(max_length=255)
    cropped_picture = models.URLField()
    full_picture = models.URLField()
示例#2
0
class Banner(models.Model):

    objects = models.Manager()
    titulo = models.CharField(max_length=200, blank=True)
    descricao = models.TextField(blank=True)
    link_img = models.URLField(unique=True)
    link = models.URLField()
    criado_em = models.DateTimeField(auto_now_add=True)
    modificado_em = models.DateTimeField(auto_now=True)

    class Meta:
        ordering = ['-criado_em']
示例#3
0
class TwitterUser(models.Model):
  id_str = models.CharField(max_length=256, primary_key=True)
  name = models.CharField(max_length=256)
  screen_name = models.CharField(max_length=256)
  location = models.CharField(max_length=256, null=True)
  url = models.URLField(max_length=512, null=True)
  description = models.CharField(max_length=1024, null=True)
  verified = models.BooleanField(default=False)
  profile_image_url = models.URLField(max_length=512, null=True)
  lang = models.CharField(max_length=256, null=True)
  user_status = models.ArrayField(
    model_container = TwitterUserStatus,
    model_form_class = TwitterUserStatusForm,
    null=True
  )
示例#4
0
class LibraryComponent(models.Model):
    name = models.CharField(max_length=200)
    svg_path = models.CharField(max_length=400)
    thumbnail_path = models.CharField(max_length=400)
    description = models.CharField(max_length=400)
    data_link = models.URLField(max_length=200)
    full_name = models.CharField(max_length=200)
    keyword = models.CharField(max_length=200)
    symbol_prefix = models.CharField(max_length=10)
    component_library = models.ForeignKey(Library,
                                          on_delete=models.CASCADE,
                                          null=False,
                                          related_name='library')

    # For Django Admin Panel
    def image_tag(self):
        if self.svg_path:
            return mark_safe(
                '<img src="/%s" style="width: 45px; height:45px;" />' %
                self.svg_path)  # noqa
        else:
            return 'No Image Found'

    image_tag.short_description = 'Image'

    def __str__(self):
        return self.name
示例#5
0
class Quote(models.Model):
    name = models.CharField(max_length=200)
    blog_url = models.URLField(blank=True, default='')
    description = models.TextField()

    def __str__(self):
        return self.name
示例#6
0
class DatasetImage(models.Model):
    _id = models.ObjectIdField()
    name = models.CharField(max_length=128, null=False, blank=False)
    url = models.URLField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    label = models.CharField(max_length=32, null=False, blank=False)
    metadata = models.DictField(null=True)
示例#7
0
文件: models.py 项目: prashil40/sem8
class LetterClient(models.Model):
    _id = models.ObjectIdField()
    account_no = models.CharField(max_length=50, blank=False)
    creditor_name = models.CharField(max_length=100, blank=False)
    mention_date = models.DateField(blank=True, default=datetime.date.today)
    status = models.BooleanField(blank=True, default=True)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    stop_at = models.DateTimeField(blank=True, null=True)

    letter_sub_url = models.URLField(max_length=500, blank=True, default="")
    letter_url = models.URLField(max_length=500, blank=True, default="")

    def __str__(self):
        return self.pdf_file
示例#8
0
文件: models.py 项目: prashil40/sem8
class Subscription(models.Model):
    _id = models.ObjectIdField()
    sub_status = models.BooleanField(default=True)
    period_start = models.DateTimeField(auto_now_add=True)
    period_end = models.DateTimeField(blank=True, default=get_default_date)
    billing_address = models.TextField(default="")
    unsubscribe_date = models.DateTimeField(blank=True,
                                            default=get_default_date)

    rzp_sub_id = models.CharField(max_length=500, blank=True, default='')

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    client_url = models.URLField(max_length=500, blank=False, default="")
    pricing_url = models.URLField(max_length=500, blank=False, default="")
示例#9
0
class GenericModel(models.Model):
    big_int = models.BigIntegerField()
    bool = models.BooleanField()
    char = models.CharField(max_length=20)
    comma_int = models.CommaSeparatedIntegerField()
    date = models.DateField()
    date_time = models.DateTimeField()
    decimal = models.DecimalField(max_digits=10, decimal_places=5)
    email = models.EmailField()
    float = models.FloatField()
    integer = models.IntegerField()
    null_bool = models.NullBooleanField()
    pos_int = models.PositiveIntegerField()
    pos_small_int = models.PositiveSmallIntegerField()
    slug = models.SlugField()
    small_int = models.SmallIntegerField()
    text = models.TextField()
    time = models.TimeField()
    url = models.URLField()
    ip = models.GenericIPAddressField()
    uuid = models.UUIDField()

    # TODO: add these
    # basic_file = models.FileField()
    # image = models.ImageField()

    objects = models.DjongoManager()
示例#10
0
class Startech(models.Model):
    brand = models.CharField(max_length=50)
    description = models.ListField(models.CharField(max_length=1000))
    display_size = models.CharField(max_length=10)
    graphics_memory = models.CharField(max_length=30)
    img_link = models.URLField(max_length=10000)
    price = models.IntegerField(default=0)
    product_link = models.URLField(max_length=10000)
    product_title = models.CharField(max_length=1000)
    ram = models.CharField(max_length=10)
    ram_type = models.CharField(max_length=100)
    status = models.CharField(max_length=100)
    processor = models.CharField(max_length=100)
    storage = models.DictField()
    website = models.CharField(max_length=100)
    _id = models.CharField(primary_key=True, max_length=100)
class Student(models.Model):
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    eid = models.CharField(max_length=20)
    phone = models.CharField(max_length=12)
    email = models.EmailField(max_length=100)
    linkedIn = models.CharField(max_length=100, blank=True)
    resume_link = models.URLField(max_length=100, blank=True)
    intentions = models.DictField(default={})
    interests = models.DictField(default={})
    time_commitment = models.CharField(max_length=100)
    international = models.BooleanField(default=False)
    fin_aid = models.BooleanField(default=False)
    transportation = models2.BooleanField(default=False)
    flexible_hours = models2.BooleanField(default=False)
    work_remotely = models2.BooleanField(default=False)
    other_availability = models.TextField(max_length=500, blank=True)
    school = models.DictField(default={})
    program = models.DictField(default={})
    experience = models.DictField(default={})
    tech_skills = models.DictField(default={})
    prof_skills = models.DictField(default={})
    other_skills = models.TextField(max_length=500, blank=True)
    cohort = models.CharField(max_length=100)
    unique_id = models.CharField(max_length=100, unique=True, null=True)
    created_at = models.DateTimeField(auto_now_add=True)
    hear = models.CharField(max_length=100)
class Resource(models.Model):
    _id = models.ObjectIdField()
    product_id = models.CharField(max_length=100, blank=True, null=True)
    version = models.CharField(max_length=20)  # This field maps the Product Spec version
    provider = models.ForeignKey(Organization, on_delete=models.DO_NOTHING)
    content_type = models.CharField(max_length=100)
    download_link = models.URLField()
    resource_path = models.CharField(max_length=100)
    old_versions = models.ArrayField(
        model_container=ResourceVersion
    )
    state = models.CharField(max_length=20)
    resource_type = models.CharField(max_length=100, blank=True, null=True)
    is_public = models.BooleanField(default=False)
    has_terms = models.BooleanField(default=False)

    bundled_assets = models.JSONField(default=[]) # List
    meta_info = models.JSONField(default={}) # Dict

    def get_url(self):
        return self.download_link

    def get_uri(self):
        base_uri = settings.SITE

        return urljoin(base_uri, 'charging/api/assetManagement/assets/' + str(self.pk))

    class Meta:
        app_label = 'wstore'
示例#13
0
class Publication(models.Model):
    title = models.CharField(max_length=30)
    description = models.TextField()
    publisher = models.CharField(max_length=30)
    publication_date = models.DateField()
    publication_url = models.URLField(max_length=200)
    faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)
示例#14
0
class InstagramUser(models.Model):
  id = models.CharField(max_length=256, primary_key=True)
  username = models.CharField(max_length=256)
  fullname = models.CharField(max_length=256)
  bio = models.CharField(max_length=514, blank=True)
  has_channel = models.BooleanField(null=True)
  is_business_account = models.BooleanField(null=True)
  business_category_name = models.CharField(max_length=256, null=True)
  is_verified = models.BooleanField(default=False)
  profile_pic_url = models.URLField(max_length=512, blank=True) 
  followers = models.IntegerField()
  following = models.IntegerField()
  posts = models.IntegerField()
  engagement = models.FloatField()
  average_likes = models.IntegerField()
  average_comments = models.IntegerField()
  platforme = models.CharField(max_length=256, null=True)

  CLASS_INFLUENCE = [
    ('simple-user', 'simple-user'),
    ('micro-influencer', 'micro-influencer'),
    ('influencer', 'influencer'),
  ]
  class_influence = models.CharField(
    max_length=48,
    choices=CLASS_INFLUENCE,
    null=True
  )

  user_status = models.ArrayField(
    model_container = InstagramUserStatus,
    model_form_class = InstagramUserStatusForm,
    null=True,
  )
示例#15
0
class Faculty(models.Model):
    faculty_id = models.CharField(max_length=7, null=False)
    faculty_name = models.CharField(max_length=30, null=True)
    designation = models.CharField(max_length=30, null=True)
    department = models.CharField(max_length=2,
                                  choices=DEPT_LIST,
                                  null=False,
                                  default='CE')
    image = models.FileField(upload_to='', blank=True, default='NoImage.png')
    # qualifications = models.ArrayField(model_container=Qualification, null=True)
    phone = PhoneNumberField(
        blank=False,
        null=False,
    )
    email = models.EmailField(blank=True, null=True)
    website = models.URLField(max_length=200, null=True)
    office = models.CharField(max_length=30, null=True)
    biography = models.TextField(null=True)
    specializations = models.ArrayField(model_container=Topic,
                                        model_form_class=TopicForm,
                                        null=True)
    teaching_interests = models.ArrayField(model_container=Topic, null=True)
    faculty_type = models.CharField(max_length=10, null=True)

    class Meta:
        verbose_name_plural = "faculties"
示例#16
0
class Article(models.Model):
    """A news article."""

    _id = models.CharField("MongoDB ID",
                           max_length=40,
                           null=False,
                           blank=False,
                           primary_key=True)
    # scrape_id = models.CharField("Scrape ID",max_length=80, null=True, blank=True)
    headline = models.CharField("Headline",
                                max_length=300,
                                null=False,
                                blank=False)
    date = models.DateField("Date", auto_now_add=True)
    source = models.CharField("Source",
                              max_length=200,
                              null=False,
                              blank=False)
    url = models.URLField("URL", null=True)
    # word_count = models.IntegerField("Word Count", null=True, blank=True)
    text = models.TextField("Text", blank=True)
    subjectivity = models.DecimalField("Subjectivity",
                                       max_digits=25,
                                       decimal_places=25)
    polarity = models.DecimalField("Polarity",
                                   max_digits=25,
                                   decimal_places=25)
    disease = models.CharField("Disease",
                               max_length=300,
                               null=True,
                               blank=True)

    def __str__(self):
        """Returns string representation of the model."""
        return f"{self.source} | {self.disease} | {self.headline}"
示例#17
0
class Blog(models.Model):
    blog = models.CharField(max_length=250)
    blog_url = models.URLField(blank=True, default='')
    description = models.TextField()

    def __str__(self):
        return self.blog
示例#18
0
class Notification(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    product_title = models.CharField(max_length=1000)
    product_link = models.URLField(max_length=1000)
    website_name = models.CharField(max_length=100)
    old_price = models.IntegerField(default=0)
    new_price = models.IntegerField(default=0)
    seen = models.BooleanField(default=False)
示例#19
0
class Series(models.Model):
    series_name = models.CharField(max_length=255)
    series_poster = models.URLField()  #! Should be image field
    genre = models.ManyToManyField(Genre)
    description = models.CharField(max_length=255)
    trailer_link = models.URLField()  #! Should be file field
    cast = models.ArrayField(model_container=Cast, )
    language = models.ManyToManyField(Language, )
    aired = models.DateField()
    rating_info = models.IntegerField()
    production_Company = models.CharField(max_length=255)
    gallery = models.ManyToManyField(Gallery, )

    objects = models.DjongoManager()

    def __str__(self):
        return self.series_name
示例#20
0
class FBInstaCreatives(models.Model):
    header = models.CharField(max_length=128)
    description = models.CharField(max_length=256)
    url = models.URLField()
    image = models.CharField(max_length=128)

    class Meta:
        abstract = True
示例#21
0
class Book(models.Model):
    _id = models.ObjectIdField()
    gutenberg_id = models.IntegerField()
    title = models.CharField(max_length=255)
    language = models.CharField(max_length=50)
    cover_url = models.URLField()
    small_cover_url = models.URLField()
    download_url = models.URLField()
    centrality_rank = models.IntegerField(default=-1)
    jaccard_calculated = models.BooleanField(default=False)
    authors = models.ArrayField(model_container=Author)
    bookshelves = models.ArrayField(model_container=BookShelve)
    keywords = models.ArrayField(model_container=KeywordOccurrence)
    # Manager
    objects = models.DjongoManager()

    def __str__(self):
        return self.title or f"{self.id}"
示例#22
0
class Table(models.Model):
    url = models.URLField()
    num = models.IntegerField()

    def __str__(self):
        return f'<{self.num}>'

    class Meta:
        abstract = True
示例#23
0
class Website(models.Model):
    created_at = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_at = models.DateTimeField(auto_now_add=False, auto_now=True)
    name = models.CharField(max_length=30)
    link = models.URLField(max_length=200)
    description = models.TextField()

    def __str__(self):
        return self.name
示例#24
0
class GitHub(models.Model):
    id = models.IntegerField(primary_key=True)
    github_name = models.CharField(max_length=200)
    github = models.URLField()
    created_at = models.DateTimeField(auto_now_add=True, auto_created=True)
    updated_at = models.DateTimeField(auto_now_add=True, auto_created=True)

    def __str__(self):
        return self.github_name
示例#25
0
class GoogleCreatives(models.Model):
    header_1 = models.CharField(max_length=128)
    header_2 = models.CharField(max_length=128)
    description = models.CharField(max_length=256)
    url = models.URLField()
    image = models.CharField(max_length=128)

    class Meta:
        abstract = True
示例#26
0
class Bookmarks(models.Model):
    # bookmark = models.EmbeddedModelField()
    name = models.CharField(max_length=200)
    bookmark = models.URLField()
    created_at = models.DateTimeField(auto_now_add=True, auto_created=True)
    updated_at = models.DateTimeField(auto_now_add=True, auto_created=True)

    def __str__(self):
        return self.name
示例#27
0
class RawNews(models.Model):
    class Meta:
        db_table = 'raw'

    _id = models.ObjectIdField()
    article_id = models.CharField(max_length=100)
    time = models.DateTimeField()
    title = models.CharField(max_length=500)
    article_url = models.URLField(max_length=500, unique=True)
    origin_url = models.URLField(max_length=500, null=True, blank=True)
    body_html = models.TextField()
    provider = models.CharField(max_length=50)
    meta = models.EmbeddedField(
        model_container=TagHolder,
        model_form_class=TagHolderForm,
        null=True,
        blank=True,
    )
示例#28
0
class ElasticPage(models.Model):
    name = models.CharField(max_length=210, primary_key=True)
    url = models.URLField()
    num = models.IntegerField()
    text = models.TextField()
    doc_name = models.CharField(max_length=200)
    document = models.ForeignKey(Document, on_delete=models.CASCADE)

    def __str__(self):
        return f'<{self.doc_name}-{self.num} {self.pk}>'
示例#29
0
文件: models.py 项目: prashil40/sem8
class LetterBureau(models.Model):
    _id = models.ObjectIdField()
    letter_client_url = models.URLField(max_length=500, blank=True, default="")
    bureau_url = models.URLField(max_length=500, blank=True, default="")
    pdf_file = models.FileField(upload_to="letters/", blank=True, null=True)

    last_run_at = models.DateTimeField(null=True,
                                       blank=True,
                                       default=get_default_date)
    next_run_at = models.DateTimeField(null=True,
                                       blank=True,
                                       default=get_default_date)
    cron_expression = models.CharField(max_length=200, default='0 0 1 1 0')

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def save(self, *args, **kwargs):
        self.last_run_at = datetime.datetime.now().replace(tzinfo=pytz.UTC)

        # letter_client_id = get_id_from_url(self.letter_client_url)
        # letter_sub_url = LetterClient.objects.filter(
        #     _id=ObjectId(letter_client_id)
        # ).values("letter_sub_url")[0]["letter_sub_url"]
        # client_id = Client.objects.filter(letter_sub_url=letter_sub_url).values("_id")[
        #     0
        # ]["_id"]
        # client_url = f"http://127.0.0.1:8000/api/auth/client/{client_id}/"
        # pricing_id = get_id_from_url(
        #     Subscription.objects.filter(client_url=client_url).values("pricing_url")[0][
        #         "pricing_url"
        #     ]
        # )
        # duration = Pricing.objects.filter(_id=ObjectId(pricing_id)).values('duration')[0]['duration']
        self.cron_expression = get_cron_expression(
            args[0] if len(args) > 0 else 'm')
        print(self.cron_expression)

        iter = croniter(self.cron_expression, self.last_run_at)
        self.next_run_at = (iter.get_next(
            datetime.datetime)).replace(tzinfo=pytz.UTC)
        super(LetterBureau, self).save(*args, **kwargs)
示例#30
0
class QueryImage(models.Model):
    _id = models.ObjectIdField()
    file = models.FileField(blank=False, null=False)
    url = models.URLField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)

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

    class Meta:
        ordering = ['created']