New files
locale/es/LC_MESSAGES/django.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-15 12:54+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? "
"1 : 2;\n"
#: app/models.py:23
msgid "Article"
msgstr "Artículo"
#: app/models.py:24
msgid "Articles"
msgstr "Artículos"
#: app/models.py:26
msgid "title"
msgstr "título"
#: app/models.py:27
msgid "content"
msgstr "contenido"
#: app/models.py:28
msgid "word count"
msgstr "recuento de palabras"
#: app/models.py:29
msgid "twitter post"
msgstr "post de twitter"
#: app/models.py:31
msgid "status"
msgstr "estado"
#: app/models.py:36
msgid "created at"
msgstr "creado en"
#: app/models.py:37
msgid "updated at"
msgstr "actualizado en"
#: app/models.py:40
msgid "creator"
msgstr "creador"
app/migrations/0004_alter_article_options_alter_article_content_and_more.py
# Generated by Django 5.1.3 on 2024-11-15 12:11
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_article_creator_alter_article_word_count'),
]
operations = [
migrations.AlterModelOptions(
name='article',
options={'verbose_name': 'Article', 'verbose_name_plural': 'Articles'},
),
migrations.AlterField(
model_name='article',
name='content',
field=models.TextField(blank=True, default='', verbose_name='content'),
),
migrations.AlterField(
model_name='article',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='created at'),
),
migrations.AlterField(
model_name='article',
name='creator',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='articles', to=settings.AUTH_USER_MODEL, verbose_name='creator'),
),
migrations.AlterField(
model_name='article',
name='status',
field=models.CharField(choices=[('draft', 'draft'), ('inprogress', 'in progress'), ('published', 'published')], default='draft', max_length=20, verbose_name='status'),
),
migrations.AlterField(
model_name='article',
name='title',
field=models.CharField(max_length=100, verbose_name='title'),
),
migrations.AlterField(
model_name='article',
name='twitter_post',
field=models.TextField(blank=True, default='', verbose_name='twitter post'),
),
migrations.AlterField(
model_name='article',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='updated at'),
),
migrations.AlterField(
model_name='article',
name='word_count',
field=models.IntegerField(blank=True, default='', verbose_name='word count'),
),
]
Modified files
app/models.py
---
+++
@@ -1,7 +1,9 @@
import re
+
from django.conf import settings
from django.db import models
from django.contrib.auth.models import AbstractUser
+from django.utils.translation import gettext_lazy as _
ARTICLE_STATUS = (
@@ -14,19 +16,31 @@
class UserProfile(AbstractUser):
pass
+
class Article(models.Model):
- title = models.CharField(max_length=100)
- content = models.TextField(blank=True, default="")
- word_count = models.IntegerField(blank=True, default="")
- twitter_post = models.TextField(blank=True, default="")
+
+ class Meta:
+ verbose_name = _("Article")
+ verbose_name_plural = _("Articles")
+
+ title = models.CharField(_("title"), max_length=100)
+ content = models.TextField(_("content"), blank=True, default="")
+ word_count = models.IntegerField(_("word count"), blank=True, default="")
+ twitter_post = models.TextField(_("twitter post"), blank=True, default="")
status = models.CharField(
+ _("status"),
max_length=20,
choices=ARTICLE_STATUS,
default="draft",
)
- created_at = models.DateTimeField(auto_now_add=True)
- updated_at = models.DateTimeField(auto_now=True)
- creator = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="articles")
+ created_at = models.DateTimeField(_("created at"), auto_now_add=True)
+ updated_at = models.DateTimeField(_("updated at"), auto_now=True)
+ creator = models.ForeignKey(
+ settings.AUTH_USER_MODEL,
+ verbose_name=_("creator"),
+ on_delete=models.CASCADE,
+ related_name="articles",
+ )
def save(self, *args, **kwargs):
text = re.sub(r"<[^>]*>", "", self.content).replace(" ", " ")