python - Getting error in save(self, *args, **kwargs): in the "Account" class model that inherited from (models.Model) -


the following below class model , tried the source code getting error again need explain problem save() method

from django.conf import settings django.core.mail import send_mail django.db import models django.template.loader import render_to_string django.utils import timezone  cms.models import cmsplugin # create models here.  class account(models.model):  # # note: in section should optional, fields # made required in forms. #  email = models.emailfield(u'email',     blank=true,     default='',     error_message={'invalid': 'please enter correctly formatted email address.'},     help_text=u'your email address',     max_length=255, ) password = models.charfield(u'password',     blank=true,     default='',     error_message={'invalid': 'please enter password correctly.'},     help_text=u'your password more 6 character',     max_length=255, ) # meta, non-form data created_date = models.datetimefield(u'created date',     blank=true,     default=timezone.now,     help_text=u'when person completed account creation.', ) was_created = models.booleanfield(u'has been created?',     default=false,     help_text=u'check if has reached out person.', ) notes = models.textfield(u'account notes',     blank=true,     default='',     help_text=u'internal notes relating account person.', )  referer = models.charfield(u'referring page',     blank=true,     default='',     help_text=u'this page visitor on before coming creating page.' )  def send_notification_email(self):     """     sends notification email list of recipients defined in     settings.notifications informing them new account has arrived.      server_email defined in settings , account "from"     address email sent webserver.      managers needs defined in settings , should list     containing email addresses of should receive     notification of incoming account.     """     # using template overkill but...     email_subject = render_to_string('account/notification-subject.txt', {         'account': self,     })      email_body = render_to_string('account/notification-body.txt', {         'account': self,     })      try:         send_email(             email_subject,             email_body,             settings.server_email,             settings.managers,             fail_silently=(not settings.debug)         )     except exception:         # if not in debug (development) mode, silently ignore         # exceptions avoid interrupting capture of submitter'settings         # details. if in debug mode, raise error can          # troubleshoot.         if (settings.debug):             raise  def save(self, *args, **kwargs):      if not self.pk:         #         # if using celery, should scheduled, not         # executed in request/response cycle.         #         try:             self.send_notification_email()         except:             #             # precaution, should there issue             # emailing, not want prevent new account             # object being saved.             #             pass      super(account, self).save(*args, **kwargs)     #models.model.save(self, *args, **kwargs)  def __unicode__(self):     return '%s (%s)' % (self.email, str(self.created_date), )  class accountpluginmodel(cmsplugin):     title = models.charfield(u'title',         blank=true,         help_text=u'optional, title of widget.',         max_length=64,     ) 

the error here shown in terminal:

  file "/home/tarek/documents/python/teknikcloud-cms/account/models.py", line 91     def save(self, *args, **kwargs):                                    ^ indentationerror: unindent not match outer indentation level 

i need explanation override save() method


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -