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
cf3464d8
Commit
cf3464d8
authored
Oct 10, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create change object for new strings (issue #241)
parent
9ae5cade
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
trans/models/changes.py
trans/models/changes.py
+2
-0
trans/models/unit.py
trans/models/unit.py
+13
-1
No files found.
trans/models/changes.py
View file @
cf3464d8
...
...
@@ -144,6 +144,7 @@ class Change(models.Model):
ACTION_DICTIONARY_NEW
=
10
ACTION_DICTIONARY_EDIT
=
11
ACTION_DICTIONARY_UPLOAD
=
12
ACTION_NEW_SOURCE
=
13
ACTION_CHOICES
=
(
(
ACTION_UPDATE
,
ugettext_lazy
(
'Resource update'
)),
...
...
@@ -159,6 +160,7 @@ class Change(models.Model):
(
ACTION_DICTIONARY_NEW
,
ugettext_lazy
(
'Glossary added'
)),
(
ACTION_DICTIONARY_EDIT
,
ugettext_lazy
(
'Glossary updated'
)),
(
ACTION_DICTIONARY_UPLOAD
,
ugettext_lazy
(
'Glossary uploaded'
)),
(
ACTION_NEW_SOURCE
,
ugettext_lazy
(
'New source string'
)),
)
unit
=
models
.
ForeignKey
(
Unit
,
null
=
True
)
...
...
trans/models/unit.py
View file @
cf3464d8
...
...
@@ -444,11 +444,23 @@ class Unit(models.Model):
)
# Ensure we track source string
Source
.
objects
.
get_or_create
(
dummy
,
created
=
Source
.
objects
.
get_or_create
(
checksum
=
self
.
checksum
,
subproject
=
self
.
translation
.
subproject
)
# Create change object for new source string
if
created
:
from
trans.models.changes
import
Change
Change
.
objects
.
create
(
translation
=
self
.
translation
,
action
=
Change
.
ACTION_NEW_SOURCE
,
user
=
request
.
user
,
unit
=
self
,
author
=
user
)
def
is_plural
(
self
):
'''
Checks whether message is plural.
...
...
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