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
01e18445
Verified
Commit
01e18445
authored
3 years ago
by
Lloyd Meins
Committed by
Nik | Klampfradler
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ensure uniqueness per site
parent
bd9d127d
No related branches found
No related tags found
No related merge requests found
Changes
3
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 @
01e18445
...
...
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Changed
~~~~~~~~
* Ensure uniqueness per site of FAQ sections and categories.
`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 @
01e18445
# 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 @
01e18445
...
...
@@ -37,6 +37,10 @@ class FAQSection(ExtensibleModel):
verbose_name_plural
=
_
(
"
FAQ sections
"
)
ordering
=
[
"
position
"
]
constraints
=
[
models
.
UniqueConstraint
(
fields
=
[
"
site_id
"
,
"
name
"
],
name
=
"
unique_section_name_per_site
"
)
]
@property
def
visible_questions
(
self
):
return
self
.
questions
.
filter
(
show
=
True
)
...
...
@@ -95,3 +99,9 @@ class IssueCategory(ExtensibleModel):
class
Meta
:
verbose_name
=
_
(
"
Issue category
"
)
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