Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
693d71d9
Commit
693d71d9
authored
Feb 04, 2016
by
Jitka Novotna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ComponentList model
parent
53d3b473
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
3 deletions
+90
-3
weblate/trans/admin.py
weblate/trans/admin.py
+6
-1
weblate/trans/migrations/0058_componentlist.py
weblate/trans/migrations/0058_componentlist.py
+26
-0
weblate/trans/models/__init__.py
weblate/trans/models/__init__.py
+2
-1
weblate/trans/models/componentlist.py
weblate/trans/models/componentlist.py
+44
-0
weblate/trans/tests/test_models.py
weblate/trans/tests/test_models.py
+12
-1
No files found.
weblate/trans/admin.py
View file @
693d71d9
...
...
@@ -24,7 +24,7 @@ from django.utils.translation import ugettext_lazy as _
from
weblate.trans.models
import
(
Project
,
SubProject
,
Translation
,
Advertisement
,
Unit
,
Suggestion
,
Comment
,
Check
,
Dictionary
,
Change
,
Source
,
WhiteboardMessage
,
GroupACL
Source
,
WhiteboardMessage
,
GroupACL
,
ComponentList
,
)
...
...
@@ -228,6 +228,10 @@ class WhiteboardAdmin(admin.ModelAdmin):
list_filter
=
[
'project'
,
'language'
]
class
ComponentListAdmin
(
admin
.
ModelAdmin
):
list_display
=
[
'title'
]
class
AdvertisementAdmin
(
admin
.
ModelAdmin
):
list_display
=
[
'placement'
,
'date_start'
,
'date_end'
,
'text'
]
search_fields
=
[
'text'
,
'note'
]
...
...
@@ -263,6 +267,7 @@ admin.site.register(SubProject, SubProjectAdmin)
admin
.
site
.
register
(
Advertisement
,
AdvertisementAdmin
)
admin
.
site
.
register
(
WhiteboardMessage
,
WhiteboardAdmin
)
admin
.
site
.
register
(
GroupACL
,
GroupACLAdmin
)
admin
.
site
.
register
(
ComponentList
,
ComponentListAdmin
)
# Show some controls only in debug mode
if
settings
.
DEBUG
:
...
...
weblate/trans/migrations/0058_componentlist.py
0 → 100644
View file @
693d71d9
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'trans'
,
'0057_indexupdate_language_code'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'ComponentList'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'title'
,
models
.
CharField
(
max_length
=
100
)),
(
'components'
,
models
.
ManyToManyField
(
to
=
'trans.SubProject'
)),
],
options
=
{
'verbose_name'
:
'Component list'
,
'verbose_name_plural'
:
'Component lists'
,
},
),
]
weblate/trans/models/__init__.py
View file @
693d71d9
...
...
@@ -38,6 +38,7 @@ from weblate.trans.models.group_acl import GroupACL
from
weblate.trans.models.source
import
Source
from
weblate.trans.models.advertisement
import
Advertisement
from
weblate.trans.models.whiteboard
import
WhiteboardMessage
from
weblate.trans.models.componentlist
import
ComponentList
from
weblate.trans.search
import
clean_search_unit
from
weblate.trans.signals
import
(
vcs_post_push
,
vcs_post_update
,
vcs_pre_commit
,
vcs_post_commit
,
...
...
@@ -51,7 +52,7 @@ from weblate.trans.scripts import (
__all__
=
[
'Project'
,
'SubProject'
,
'Translation'
,
'Unit'
,
'Check'
,
'Suggestion'
,
'Comment'
,
'Vote'
,
'IndexUpdate'
,
'Change'
,
'Dictionary'
,
'Source'
,
'Advertisement'
,
'WhiteboardMessage'
,
'GroupACL'
,
'Advertisement'
,
'WhiteboardMessage'
,
'GroupACL'
,
'ComponentList'
,
]
...
...
weblate/trans/models/componentlist.py
0 → 100644
View file @
693d71d9
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""Components list."""
from
django.db
import
models
from
django.core.exceptions
import
ValidationError
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils.translation
import
ugettext_lazy
as
_
@
python_2_unicode_compatible
class
ComponentList
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
components
=
models
.
ManyToManyField
(
'SubProject'
)
def
clean
(
self
):
if
not
self
.
title
:
raise
ValidationError
(
_
(
'Name must be specified'
))
def
__str__
(
self
):
return
self
.
title
class
Meta
(
object
):
verbose_name
=
_
(
'Component list'
)
verbose_name_plural
=
_
(
'Component lists'
)
weblate/trans/tests/test_models.py
View file @
693d71d9
...
...
@@ -36,7 +36,7 @@ from django.core.exceptions import ValidationError
from
weblate.trans.models
import
(
Project
,
SubProject
,
Source
,
Unit
,
WhiteboardMessage
,
Check
,
Suggestion
,
IndexUpdate
,
IndexUpdate
,
ComponentList
,
get_related_units
,
)
from
weblate
import
appsettings
...
...
@@ -953,6 +953,17 @@ class WhiteboardMessageTest(TestCase):
WhiteboardMessage
()
class
ComponentListTest
(
TestCase
):
"""Test(s) for ComponentList model."""
def
test_can_be_imported
(
self
):
"""Test that ComponentList model can be imported.
Rather dumb test just to make sure there are no obvious parsing errors.
"""
ComponentList
()
class
ModelTestCase
(
RepoTestCase
):
def
setUp
(
self
):
super
(
ModelTestCase
,
self
).
setUp
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment