Skip to content

Commit

Permalink
Article visible for - model (#5)
Browse files Browse the repository at this point in the history
Article permissions
  • Loading branch information
berk76 authored Mar 15, 2024
1 parent 2755440 commit 0f32812
Show file tree
Hide file tree
Showing 21 changed files with 1,058 additions and 207 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SVJIS PY

Tento repozitář obsahuje pokus o reimplementaci [SVJIS](https://svjis.github.io/) do [Django](https://www.djangoproject.com/).
Tento repozitář obsahuje reimplementaci [SVJIS](https://svjis.github.io/) do [Django](https://www.djangoproject.com/). Na reimplementaci se stále pracuje...


## 1 Instalace
Předpokládá se, že máte na počítači nainstalovaný python verze 3.10 a nebo vyšší.
Expand Down Expand Up @@ -43,7 +44,7 @@ python manage.py compilemessages
python manage.py runserver
```

Aplikace běží na adrese http://127.0.0.1:8000/ uživatel je `admin` heslo je `masterkey`. Heslo změňte v **Administrace - Uživatelé**.
Aplikace běží na adrese http://127.0.0.1:8000/ uživatel je `admin` heslo je `masterkey`. Heslo změňte v **Osobní nastavení - Změna hesla**.

## 3 Parametrizace

Expand Down
8 changes: 7 additions & 1 deletion svjis/articles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@


class ArticleMenuForm(forms.ModelForm):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['parent'].queryset = models.ArticleMenu.objects.exclude(pk=self.instance.pk)

class Meta:
model = models.ArticleMenu
fields = ("description", "hide", "parent",)
Expand All @@ -18,14 +23,15 @@ class Meta:
class ArticleForm(forms.ModelForm):
class Meta:
model = models.Article
fields = ("header", "perex", "body", "menu", "allow_comments", "published",)
fields = ("header", "perex", "body", "menu", "allow_comments", "published", "visible_for_all")
widgets = {
'header': forms.widgets.TextInput(attrs={'class': 'common-input', 'size': '50'}),
'perex': forms.widgets.Textarea(attrs={'class': 'common-textarea', 'rows': '10', 'cols': '80', 'wrap': True}),
'body': forms.widgets.Textarea(attrs={'class': 'common-textarea', 'rows': '20', 'cols': '80', 'wrap': True}),
'menu': forms.widgets.Select(attrs={'class': 'common-input'}),
'allow_comments': forms.widgets.CheckboxInput(attrs={'class': 'common-input'}),
'published': forms.widgets.CheckboxInput(attrs={'class': 'common-input'}),
'visible_for_all': forms.widgets.CheckboxInput(attrs={'class': 'common-input'}),
}


Expand Down
Loading

0 comments on commit 0f32812

Please sign in to comment.