hidden -> public
This commit is contained in:
parent
e95c3f81f5
commit
4a2217c528
3 changed files with 31 additions and 4 deletions
|
@ -32,8 +32,8 @@ class DocumentExternalListFilter(admin.SimpleListFilter):
|
|||
|
||||
class DocumentAdmin(admin.ModelAdmin):
|
||||
exclude = ('is_removed',)
|
||||
list_display = ('title', 'author', 'published', 'hidden', 'filed_under')
|
||||
list_filter = ('tags', 'hidden', DocumentExternalListFilter)
|
||||
list_display = ('title', 'author', 'published', 'public', 'filed_under')
|
||||
list_filter = ('tags', 'public', DocumentExternalListFilter)
|
||||
search_fields = ('title', 'author', 'published')
|
||||
|
||||
@staticmethod
|
||||
|
|
27
sdbs_pile/pile/migrations/0006_auto_20200329_1132.py
Normal file
27
sdbs_pile/pile/migrations/0006_auto_20200329_1132.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-29 09:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pile', '0005_auto_20200320_1329'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='document',
|
||||
name='hidden',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='document',
|
||||
name='public',
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='document',
|
||||
name='tags',
|
||||
field=models.ManyToManyField(blank=True, related_name='documents', to='pile.Tag'),
|
||||
),
|
||||
]
|
|
@ -25,7 +25,7 @@ class DocumentManager(models.Manager):
|
|||
def get_queryset(self):
|
||||
query_set = super().get_queryset().filter(is_removed=False)
|
||||
if not self._include_hidden:
|
||||
return query_set.filter(hidden=False)
|
||||
return query_set.filter(public=True)
|
||||
return query_set
|
||||
|
||||
def untagged(self):
|
||||
|
@ -39,7 +39,7 @@ class Document(SoftDeletableModel):
|
|||
published = models.CharField(max_length=128, null=False, blank=True)
|
||||
external_url = models.URLField(null=True, blank=True)
|
||||
file = models.FileField(null=True, blank=True, storage=FileSystemStorage(location='docs'))
|
||||
hidden = models.BooleanField(default=False, null=False, blank=False)
|
||||
public = models.BooleanField(default=True, null=False, blank=False)
|
||||
tags = models.ManyToManyField(Tag, related_name="documents", blank=True)
|
||||
uploaded = models.DateTimeField(auto_now_add=True, null=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue