code: def modify_announcement_view(request, id=None):
      
      if request.method == "POST":
          announcement = get_object_or_404(Announcement, id=id)
          form = AnnouncementForm(request.POST, instance=announcement)
          if form.is_valid():
              obj = form.save()
              logger.debug(form.cleaned_data)
              if "update_added_date" in form.cleaned_data and form.cleaned_data["update_added_date"]:
                  logger.debug("Update added date")
                  obj.added = timezone.now()
              # SAFE HTML
              obj.content = safe_html(obj.content)
              obj.save()
              messages.success(request, "Successfully modified announcement.")
              return redirect("index")
          else:
              messages.error(request, "Error adding announcement")
      else:
          announcement = get_object_or_404(Announcement, id=id)
          form = AnnouncementForm(instance=announcement)
  
      context = {"form": form, "action": "modify", "id": id, "announcement": announcement}
      return render(request, "announcements/add_modify.html", context)
docs: Modify an announcement.
  
      id: announcement id