예제 #1
0
class GdzBook(BaseModel, TimestampModel, ViewCounterModel):
    author = models.CharField(max_length=255)
    gdz_clas = models.ForeignKey('GdzClas', models.DO_NOTHING, blank=True, null=True, related_name='gdz_clas_books')
    gdz_subject = models.ForeignKey('GdzSubject', models.DO_NOTHING, blank=True, null=True, related_name='gdz_subject_books')
    img = models.CharField(max_length=255, blank=True, null=True)
    description = models.TextField(blank=True, null=True)
    year = models.CharField(max_length=255, blank=True, null=True)
    properties = models.CharField(max_length=255, blank=True, null=True)
    pagination = models.CharField(max_length=255, blank=True, null=True)
    public_time = UnixTimeStampField(auto_now_add=True, use_numeric=True)
    lang = models.CharField(max_length=255, blank=True, null=True)
    public = models.BooleanField()
    edition = models.CharField(max_length=255, blank=True, null=True)
    info = models.CharField(max_length=255, blank=True, null=True)
    vk_img = models.IntegerField(blank=True, null=True)
    vk_public_time = UnixTimeStampField(blank=True, null=True, use_numeric=True)
    is_promote = models.BooleanField()

    class Meta:
        db_table = 'gdz_book'

    objects = models.Manager()
    published = PublishedManager()

    def get_absolute_url(self):
        return reverse('gdz:book', args=[self.gdz_clas.slug, self.gdz_subject.slug, self.slug])

    def save(self, *args, **kwargs):
        self.uri = reverse('gdz:book', args={self.gdz_clas.slug, self.gdz_subject.slug, self.slug})
        super(GdzBook, self).save(*args, **kwargs)
예제 #2
0
class Knowall(BaseModel, TimestampModel, PublishModel, ViewCounterModel):
    text = models.TextField(blank=True, null=True)
    knowall_category = models.ForeignKey('KnowallCategory', models.DO_NOTHING, blank=True, null=True, related_name='articles')
    public = models.BooleanField(default=False)
    description = models.CharField(max_length=255, blank=True, null=True)
    thumbnail_ext = models.CharField(max_length=255, blank=True, null=True)
    length = models.SmallIntegerField(blank=True, null=True)
    nausea = models.FloatField(blank=True, null=True)
    vk_img = models.TextField(blank=True, null=True)
    vk_public_time = models.IntegerField(blank=True, null=True)

    objects = models.Manager()
    published = PublishedManager()

    class Meta:
        db_table = 'knowall'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('knowall:article', args=(self.knowall_category.slug,
                                                self.slug))

    def save(self, *args, **kwargs):
        self.uri = reverse('knowall:article', args={self.knowall_category.slug, self.slug})
        super(Knowall, self).save(*args, **kwargs)
예제 #3
0
class Writing(BaseModel, TimestampModel, PublishModel, ViewCounterModel):
    clas = models.ForeignKey('WritingClas',
                             models.DO_NOTHING,
                             blank=True,
                             null=True)
    subject = models.ForeignKey('WritingSubject',
                                models.DO_NOTHING,
                                blank=True,
                                null=True,
                                related_name='subject_writings')
    text = models.TextField()
    length = models.SmallIntegerField()
    nausea = models.FloatField()
    thumbnail_ext = models.CharField(max_length=255, blank=True, null=True)
    public = models.BooleanField()
    vk_img = models.TextField(blank=True, null=True)
    vk_public_time = models.IntegerField(blank=True, null=True)

    objects = models.Manager()
    published = PublishedManager()

    class Meta:
        db_table = 'writing'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('writing:article',
                       args=(self.clas.slug, self.subject.slug, self.slug))

    def save(self, *args, **kwargs):
        self.uri = reverse('writing:article',
                           args={self.clas.slug, self.subject.slug, self.slug})
        super(Writing, self).save(*args, **kwargs)
예제 #4
0
class LibraryAuthor(TimestampModel, PublishModel):
    author = models.CharField(max_length=255)
    description = models.TextField()
    slug = models.SlugField(max_length=255)
    length = models.SmallIntegerField(blank=True, null=True)
    nausea = models.FloatField(blank=True, null=True)
    public = models.BooleanField(default=False)
    vk_img = models.TextField(blank=True, null=True)
    vk_public_time = models.IntegerField(blank=True, null=True)
    uri = models.CharField(max_length=255)

    objects = models.Manager()
    published = PublishedManager()

    class Meta:
        db_table = 'library_author'

    def __str__(self):
        return self.author

    def get_absolute_url(self):
        return reverse('library:author', args=(self.slug, ))

    def save(self, *args, **kwargs):
        self.uri = reverse('library:author', args={self.slug})
        super(LibraryAuthor, self).save(*args, **kwargs)
예제 #5
0
class LibraryBook(BaseModel, TimestampModel, PublishModel, ViewCounterModel):
    img_ext = models.CharField(max_length=255, blank=True, null=True)
    description = models.TextField(blank=True, null=True)
    library_author = models.ForeignKey(LibraryAuthor,
                                       models.DO_NOTHING,
                                       blank=True,
                                       null=True,
                                       related_name="author_books")
    length = models.SmallIntegerField(blank=True, null=True)
    nausea = models.FloatField(blank=True, null=True)
    public = models.BooleanField(default=False)
    vk_img = models.TextField(blank=True, null=True)
    vk_public_time = models.IntegerField(blank=True, null=True)

    objects = models.Manager()
    published = PublishedManager()

    class Meta:
        db_table = 'library_book'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('library:book',
                       args=(self.library_author.slug, self.slug))

    def save(self, *args, **kwargs):
        self.uri = reverse('library:book',
                           args={self.library_author.slug, self.slug})
        super(LibraryBook, self).save(*args, **kwargs)
예제 #6
0
class GdzClas(BaseModel, TimestampModel):
    description = models.TextField(blank=True, null=True)
    is_promote = models.BooleanField(default=False)

    class Meta:
        db_table = 'gdz_clas'

    objects = models.Manager()
    published = PublishedManager()

    def get_absolute_url(self):
        return reverse('gdz:clas', args=[self.slug])

    def __str__(self):
        return "{} клас".format(self.slug)

    def save(self, *args, **kwargs):
        self.uri = reverse('gdz:clas', args={self.slug})
        super(GdzClas, self).save(*args, **kwargs)
예제 #7
0
class GdzSubject(BaseModel, TimestampModel):
    description = models.TextField(blank=True, null=True)
    gdz_clas = models.ForeignKey(GdzClas, models.DO_NOTHING, blank=True, null=True, related_name="clas_subjects")
    is_promote = models.BooleanField()

    class Meta:
        db_table = 'gdz_subject'

    objects = models.Manager()
    published = PublishedManager()

    def get_absolute_url(self):
        return reverse('gdz:subject', args=[self.gdz_clas.slug, self.slug])

    def __str__(self):
        return "{} {} клас".format(self.title, self.gdz_clas.slug)

    def save(self, *args, **kwargs):
        self.uri = reverse('gdz:subject', args={self.gdz_clas.slug, self.slug})
        super(GdzSubject, self).save(*args, **kwargs)