Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article visible for - model #5

Merged
merged 24 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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