Skip to content

Commit

Permalink
added is_posted check on task.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fulanii committed Dec 31, 2024
1 parent e5388e2 commit 8195475
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions auto_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
def post_scheduled_content(post_id, blue_username, blue_password):
try:
post = Post.objects.get(id=post_id)

client = Client()
client.login(blue_username, blue_password)
response = client.send_post(post.post)

post.is_posted = True
post.save()

if post.is_posted != True:
client = Client()
client.login(blue_username, blue_password)
response = client.send_post(post.post)

post.is_posted = True
post.save()
except Post.DoesNotExist:
print(f"Post with ID {post_id} does not exist.")

Expand Down

0 comments on commit 8195475

Please sign in to comment.