Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Hjelp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Hjelp
Commits
1e36798c
Commit
1e36798c
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Plain Diff
Merge branch '40-fields-must-be-unique-per-site' into 'master'
Resolve "Fields must be unique per site" Closes
#40
See merge request
!81
parents
bd9d127d
81076228
No related branches found
No related tags found
1 merge request
!81
Resolve "Fields must be unique per site"
Pipeline
#15374
passed
3 years ago
Stage: test
Stage: build
Stage: publish
Stage: deploy
Pipeline: AlekSIS
#15376
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+8
-0
8 additions, 0 deletions
CHANGELOG.rst
aleksis/apps/hjelp/migrations/0004_unique_constraints.py
+49
-0
49 additions, 0 deletions
aleksis/apps/hjelp/migrations/0004_unique_constraints.py
aleksis/apps/hjelp/models.py
+10
-0
10 additions, 0 deletions
aleksis/apps/hjelp/models.py
with
67 additions
and
0 deletions
CHANGELOG.rst
+
8
−
0
View file @
1e36798c
...
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
...
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Changed
~~~~~~~~
* Ensure uniqueness per site of FAQ sections and categories.
`2.0b0`_ - 2021-05-21
`2.0b0`_ - 2021-05-21
---------------------
---------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/hjelp/migrations/0004_unique_constraints.py
0 → 100644
+
49
−
0
View file @
1e36798c
# Generated by Django 3.2.3 on 2021-05-28 23:05
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
hjelp
'
,
'
0003_faqsection_position_and_show
'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'
faqsection
'
,
options
=
{
'
ordering
'
:
[
'
position
'
],
'
verbose_name
'
:
'
FAQ section
'
,
'
verbose_name_plural
'
:
'
FAQ sections
'
},
),
migrations
.
AlterModelOptions
(
name
=
'
hjelpglobalpermissions
'
,
options
=
{
'
managed
'
:
False
,
'
permissions
'
:
((
'
view_faq
'
,
'
Can view FAQ
'
),
(
'
ask_faq
'
,
'
Can ask FAQ question
'
),
(
'
report_issue
'
,
'
Can report issues
'
),
(
'
send_feedback
'
,
'
Can send feedback
'
))},
),
migrations
.
AlterField
(
model_name
=
'
faqsection
'
,
name
=
'
name
'
,
field
=
models
.
CharField
(
max_length
=
255
,
verbose_name
=
'
Name
'
),
),
migrations
.
AlterField
(
model_name
=
'
faqsection
'
,
name
=
'
position
'
,
field
=
models
.
PositiveIntegerField
(
blank
=
True
,
default
=
1
,
verbose_name
=
'
Order
'
),
),
migrations
.
AlterField
(
model_name
=
'
issuecategory
'
,
name
=
'
name
'
,
field
=
models
.
CharField
(
max_length
=
255
,
verbose_name
=
'
Name
'
),
),
migrations
.
AlterField
(
model_name
=
'
issuecategory
'
,
name
=
'
placeholder
'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
verbose_name
=
'
Placeholder
'
),
),
migrations
.
AddConstraint
(
model_name
=
'
faqsection
'
,
constraint
=
models
.
UniqueConstraint
(
fields
=
(
'
site_id
'
,
'
name
'
),
name
=
'
unique_section_name_per_site
'
),
),
migrations
.
AddConstraint
(
model_name
=
'
issuecategory
'
,
constraint
=
models
.
UniqueConstraint
(
fields
=
(
'
site_id
'
,
'
name
'
),
name
=
'
unique_category_name_per_site
'
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/hjelp/models.py
+
10
−
0
View file @
1e36798c
...
@@ -37,6 +37,10 @@ class FAQSection(ExtensibleModel):
...
@@ -37,6 +37,10 @@ class FAQSection(ExtensibleModel):
verbose_name_plural
=
_
(
"
FAQ sections
"
)
verbose_name_plural
=
_
(
"
FAQ sections
"
)
ordering
=
[
"
position
"
]
ordering
=
[
"
position
"
]
constraints
=
[
models
.
UniqueConstraint
(
fields
=
[
"
site_id
"
,
"
name
"
],
name
=
"
unique_section_name_per_site
"
)
]
@property
@property
def
visible_questions
(
self
):
def
visible_questions
(
self
):
return
self
.
questions
.
filter
(
show
=
True
)
return
self
.
questions
.
filter
(
show
=
True
)
...
@@ -95,3 +99,9 @@ class IssueCategory(ExtensibleModel):
...
@@ -95,3 +99,9 @@ class IssueCategory(ExtensibleModel):
class
Meta
:
class
Meta
:
verbose_name
=
_
(
"
Issue category
"
)
verbose_name
=
_
(
"
Issue category
"
)
verbose_name_plural
=
_
(
"
Issue categories
"
)
verbose_name_plural
=
_
(
"
Issue categories
"
)
constraints
=
[
models
.
UniqueConstraint
(
fields
=
[
"
site_id
"
,
"
name
"
],
name
=
"
unique_category_name_per_site
"
)
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment