title: How can I exclude script tags and style tags from a TextField that will turn eventually to a plain html code
body: <p>I need a way that removes Script tags and Style tags from a textarea since it runs when I post a post.</p>
  
  <p>When I post something as a Post-it should turn everything from HTML tags to plain text that HTML was applied on, therefore, script tags and style tags will be applied as well, which is quite unprofessional and risky.</p>
  
  <pre><code>class Post(models.Model):
      user = models.ForeignKey(User, related_name = 'posts', on_delete=models.CASCADE)
      created_at = models.DateTimeField(auto_now=True)
      message = models.TextField()
      message_html = models.TextField(editable = False)
      group = models.ForeignKey(Group, related_name='posts',on_delete=models.CASCADE)
  
      def __str__(self):
          return self.message
  
      def save(self, *args, **kwargs):
          self.message_html = misaka.html(self.message)
          super().save(*args, **kwargs)
  
      def get_absolute_url(self):
          return reverse('posts:single', kwargs = {'username': self.user.username,'pk':self.pk})
      class Meta:
          ordering = ['-created_at']
          unique_together = ['user', 'message']        
  </code></pre>
  
  <p>I expect the output not to be applied or built, instead, I expect it to delete the ,  and show everything inside as plain text.</p>
  
  <p>(Update)<br>
  I wanted the user to be able to use html tags within his post but I did not want him to use the script and style tags, I managed to make it work by writing this following.
  in Posts views.py</p>
  
  <pre class="lang-py prettyprint-override"><code>class CreatePost(LoginRequiredMixin, SelectRelatedMixin, generic.CreateView):
      fields = ('message', 'group')
      model = models.Post
  
      def form_valid(self, form):
          self.object = form.save(commit = False)
          self.object.user = self.request.user
          if self.request.user.is_superuser:
              # is Superuser
              self.object.message_html = misaka.html(self.object.message)
          else:
              # Not superuser
              self.object.message_html = str(self.object.message).replace("&lt;script&gt;", "").replace("&lt;/script&gt;", "").replace("&lt;style&gt;", "").replace('&lt;/style&gt;', "")
          self.object.save()
          return super().form_valid(form)
  
  </code></pre>