D
D
Dmitry Shamrilo2016-06-04 13:12:25
Django
Dmitry Shamrilo, 2016-06-04 13:12:25

How to register a field for loading a document in models?

There is a model

class New(models.Model):
    class Meta():
        db_table = 'news'
    news_title = models.CharField(max_length=200, verbose_name='Заголовок:')
    news_text = RichTextUploadingField(verbose_name='Текстовое поле:')
    news_date = models.DateField(verbose_name='Дата:')

How to register a field for downloading a document, and what would later download it from the page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-06-04
@Shamrilkinnn

class Meta():written at the end of the class
db_table = 'news'beginners should not use this at all

class Topic(models.Model):
    title = models.CharField(max_length=200, verbose_name='Заголовок:')
    text = RichTextUploadingField(verbose_name='Текстовое поле:')
    created = models.DateField(verbose_name='Дата:')
    upload = models.FileField(upload_to='uploads/')

https://docs.djangoproject.com/en/1.9/ref/models/f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question