Skip to content

Commit

Permalink
Add pinned to posts
Browse files Browse the repository at this point in the history
  • Loading branch information
joahim committed Dec 15, 2020
1 parent 2437237 commit 4e57420
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 14 deletions.
Binary file modified sledilnik/locale/sl/LC_MESSAGES/django.mo
Binary file not shown.
62 changes: 51 additions & 11 deletions sledilnik/locale/sl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-15 15:12+0100\n"
"POT-Creation-Date: 2020-12-15 15:56+0100\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"
Expand Down Expand Up @@ -87,11 +87,11 @@ msgstr "Širina intervala napovedi"
msgid "Prediction interval widths"
msgstr "Širine intervalov napovedi"

#: models/models.py:67 posts/models.py:8
#: models/models.py:67 posts/models.py:8 restrictions/models.py:31
msgid "Created"
msgstr "Ustvarjeno"

#: models/models.py:68 posts/models.py:9
#: models/models.py:68 posts/models.py:9 restrictions/models.py:32
msgid "Updated"
msgstr "Osveženo"

Expand Down Expand Up @@ -171,15 +171,15 @@ msgstr "Umrli skupaj zgornja meja"
msgid "Prediction data"
msgstr "Podatki napovedi"

#: posts/models.py:11
#: posts/models.py:11 restrictions/models.py:33
msgid "Published"
msgstr "Objavljeno"

#: posts/models.py:12
msgid "On home page"
msgstr "Na vstopni strani"
msgid "Pinned"
msgstr "Pripeto"

#: posts/models.py:14
#: posts/models.py:14 restrictions/models.py:20
msgid "Title"
msgstr "Naslov"

Expand Down Expand Up @@ -211,18 +211,58 @@ msgstr "Objava"
msgid "Posts"
msgstr "Objave"

#: settings/base.py:119
#: restrictions/models.py:21
msgid "Rule"
msgstr ""

#: restrictions/models.py:22
msgid "Regions"
msgstr ""

#: restrictions/models.py:23
msgid "Rule exceptions"
msgstr ""

#: restrictions/models.py:24
msgid "Extra rules"
msgstr ""

#: restrictions/models.py:25
msgid "Valid since"
msgstr ""

#: restrictions/models.py:26
msgid "Valid until"
msgstr ""

#: restrictions/models.py:27
msgid "Validity comment"
msgstr ""

#: restrictions/models.py:28
msgid "Comments"
msgstr ""

#: restrictions/models.py:29
msgid "Legal link"
msgstr ""

#: restrictions/models.py:35
msgid "Order"
msgstr ""

#: settings/base.py:121
msgid "Slovenian"
msgstr "Slovensko"

#: settings/base.py:120
#: settings/base.py:122
msgid "English"
msgstr "Angleško"

#: urls.py:12 urls.py:13
#: urls.py:13 urls.py:14
msgid "Sledilnik Administration"
msgstr "Sledilnik administracija"

#: urls.py:14
#: urls.py:15
msgid "Site administration"
msgstr "Administracija strani"
3 changes: 2 additions & 1 deletion sledilnik/posts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Meta:
@admin.register(models.Post)
class Post(TranslationAdmin):
form = PostForm
list_display = ["published", "on_homepage", "title", "created", "updated"]
list_editable = ["published", "pinned"]
list_display = ["published", "pinned", "title", "created", "updated"]
list_display_links = ["title"]
date_hiearchy = "created"
search_fields = ["author", "title", "blurb", "body"]
26 changes: 26 additions & 0 deletions sledilnik/posts/migrations/0006_auto_20201215_1554.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.1.4 on 2020-12-15 14:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('posts', '0005_post_on_homepage'),
]

operations = [
migrations.AlterModelOptions(
name='post',
options={'ordering': ['pinned', '-created', 'title'], 'verbose_name': 'Post', 'verbose_name_plural': 'Posts'},
),
migrations.RemoveField(
model_name='post',
name='on_homepage',
),
migrations.AddField(
model_name='post',
name='pinned',
field=models.BooleanField(db_index=True, default=False, verbose_name='Pinned'),
),
]
17 changes: 17 additions & 0 deletions sledilnik/posts/migrations/0007_auto_20201215_1557.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1.4 on 2020-12-15 14:57

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('posts', '0006_auto_20201215_1554'),
]

operations = [
migrations.AlterModelOptions(
name='post',
options={'ordering': ['-pinned', '-created', 'title'], 'verbose_name': 'Post', 'verbose_name_plural': 'Posts'},
),
]
4 changes: 2 additions & 2 deletions sledilnik/posts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Post(models.Model):
updated = models.DateTimeField(_("Updated"), auto_now=True)

published = models.BooleanField(_("Published"), default=False, db_index=True)
on_homepage = models.BooleanField(_("On home page"), default=False, db_index=True)
pinned = models.BooleanField(_("Pinned"), default=False, db_index=True)

title = models.CharField(_("Title"), max_length=200)
link_to = models.URLField(_("Link to"), null=True, blank=True)
Expand All @@ -21,7 +21,7 @@ class Post(models.Model):
class Meta:
verbose_name = _("Post")
verbose_name_plural = _("Posts")
ordering = ["-created", "title"]
ordering = ["-pinned", "-created", "title"]

def __str__(self):
return self.title

0 comments on commit 4e57420

Please sign in to comment.