Tuesday, October 1, 2013

Re: Django South - SyntaxError: invalid syntax (, line 1)

Can you use the models.py file with the user field on a bare DB?
I mean: if you start from scratch with an empty DB everything works correctly? You can create Carriers from the Django shell?


Leonardo Giordani
Author of The Digital Cat
My profile on About.me - My GitHub page - My Coderwall profile


2013/9/30 Ivan Goncalves <ivan@singular.inf.br>
Hi.... 

I'm having trouble with the South.

In the model below:

class Carrier (models.Model):
     name = models.CharField (max_length = 40, blank = False, null = False, verbose_name = 'Name')
     user = models.ForeignKey (User, blank = True, null = True)
    
     def save (self, force_insert = False, force_update = False):
         self.nome self.nome.upper = ()
         super (Carrier, self). save (force_insert, force_update)
        
     def __ unicode__ (self):
         return u '% s'% (self.nome)

the error occurs when i run the migrate after South on the app.
SyntaxError: invalid syntax (<string>, line 1)

But if my model does not have the user field, then the error message does not occur, as shown below:

class Carrier (models.Model):
     name = models.CharField (max_length = 40, blank = False, null = False, verbose_name = 'Name')
    
     def save (self, force_insert = False, force_update = False):
         self.nome self.nome.upper = ()
         super (Carrier, self). save (force_insert, force_update)
        
     def __ unicode__ (self):
         return u '% s'% (self.nome)


I need the field User. What I have to do ?

Thanks a lot.

Ivan 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/45f2764c-c903-41c2-b692-2afb9f9332ea%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEhE%2BOmH060TDzmVw%2BOgEdzMKsh1jJPnpn%3DeiZ0rkae7MJPCxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment