Commit 179880ac authored by Michal Čihař's avatar Michal Čihař

Set unit priority on import

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 8e35a9ed
...@@ -419,6 +419,12 @@ class Unit(models.Model): ...@@ -419,6 +419,12 @@ class Unit(models.Model):
previous_source == self.previous_source): previous_source == self.previous_source):
return return
# Ensure we track source string
source, source_created = Source.objects.get_or_create(
checksum=self.checksum,
subproject=self.translation.subproject
)
# Store updated values # Store updated values
self.position = pos self.position = pos
self.location = location self.location = location
...@@ -430,6 +436,7 @@ class Unit(models.Model): ...@@ -430,6 +436,7 @@ class Unit(models.Model):
self.comment = comment self.comment = comment
self.contentsum = contentsum self.contentsum = contentsum
self.previous_source = previous_source self.previous_source = previous_source
self.priority = source.priority
self.save( self.save(
force_insert=created, force_insert=created,
backend=True, backend=True,
...@@ -437,14 +444,8 @@ class Unit(models.Model): ...@@ -437,14 +444,8 @@ class Unit(models.Model):
same_state=same_state same_state=same_state
) )
# Ensure we track source string
dummy, created = Source.objects.get_or_create(
checksum=self.checksum,
subproject=self.translation.subproject
)
# Create change object for new source string # Create change object for new source string
if created: if source_created:
from weblate.trans.models.changes import Change from weblate.trans.models.changes import Change
Change.objects.create( Change.objects.create(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment