Commit a7b7ca0 1 parent 80ed549 commit a7b7ca0 Copy full SHA for a7b7ca0
File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ def clone(self, overrides=None):
105
105
return cloned_obj
106
106
107
107
@assert_draft
108
- def publish (self , overrides = None ):
108
+ def publish (self , overrides = None , dry_publish = False ):
109
109
if overrides is None :
110
110
overrides = []
111
111
@@ -114,10 +114,6 @@ def publish(self, overrides=None):
114
114
# Reference self for readability
115
115
draft_obj = self
116
116
117
- # Set the published date if this is the first time the page has been published
118
- if not draft_obj .publisher_linked :
119
- draft_obj .publisher_published_at = timezone .now ()
120
-
121
117
# Duplicate the draft object and set to published
122
118
publish_obj = self .__class__ .objects .get (pk = self .pk )
123
119
@@ -130,7 +126,8 @@ def publish(self, overrides=None):
130
126
publish_obj .publisher_draft = draft_obj
131
127
publish_obj .publisher_is_draft = False
132
128
publish_obj .publisher_is_published = True
133
- publish_obj .publisher_published_at = draft_obj .publisher_published_at
129
+ if not dry_publish :
130
+ publish_obj .publisher_published_at = timezone .now ()
134
131
135
132
for override_field in overrides :
136
133
setattr (publish_obj , override_field [0 ], override_field [1 ])
You can’t perform that action at this time.
0 commit comments