Reputation: 64
After i enter this code models.py
from django.db import models
from django.utils.encoding import smart_unicode
# Create your models here.
class SignUp(models.Model):
first_name = models.CharField(max_length = 120 , null = True , blank = True)
last_name = models.CharField(max_length = 120 , null = True , blank = True)
email = models.EmailField()
timestamp = models.DateTimeField(auto_now_add = True , auto_now = False)
updated = models.DateTimeField(auto_now_add = False , auto_now = True)
def __unicode__(self):
return smart_unicode(self.email) # return self.email
i got this error when i syncdb
C:\Users\user\Desktop\project\src>python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
338, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
312, in execute
django.setup()
File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 108, in pop
ulate
app_config.import_models(all_models)
File "C:\Python27\lib\site-packages\django\apps\config.py", line 198, in impor
t_models
self.models_module = import_module(models_module_name)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\Paramesh\Desktop\project\src\signup\models.py", line 11
updated = models.DateTimeField(auto_now_add = False , auto_now = True)
^
IndentationError: unindent does not match any outer indentation level
iam new django before this everything run with out errors
I don't get the what is the error
i tried removing the timestamp it does not work
Upvotes: 0
Views: 236
Reputation: 107
There's a tab character before timestamp. You should either use spaces or tabs to indent Python, never both.
Upvotes: 0
Reputation: 1619
You most likely have spaces mixed with tabs in your line indentation. Set your IDE to display space and tab characters and then replace the tabs with spaces.
Upvotes: 1