On 20/02/2016 6:26 AM, Sammi Singh wrote:
Hi,

I'm new to Django and facing this error
"*/django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used
in key specification without a key length")/*"

Here is my code:

class Steps(models.Model):

    author = models.ForeignKey(User)

#Â  Â  id = models.TextField(primary_key=True)

I don't think it makes sense to use a text field as a primary key. If you don't want to use the default primary key (and you need a strong case to want something else) and you really want a string as a primary key use models.CharField(max_length=99, primary_key=True)



    id = models.CharField(primary_key=True, max_length = 32)

    text = models.TextField()

    status = models.TextField()

    step_id = models.TextField(null=True)

    release_id = models.TextField(null=True)

    region = models.TextField(null=True)

    # Time is a rhinocerous

    updated = models.DateTimeField(auto_now=True)

    created = models.DateTimeField(auto_now_add=True)


class UserConfig(models.Model):

    author = models.ForeignKey(User)

#Â  Â  id = models.TextField(primary_key=True)

    id = models.CharField(primary_key=True, max_length = 32)

    co_range = models.TextField()

    tu_range = models.TextField()

    st_range = models.TextField()

    de_host = models.TextField()

    in_host1 = models.TextField()

    in_host2 = models.TextField()

    in_host3 = models.TextField()

    co_host = models.TextField()

    vp_name = models.TextField()


    # Time is a rhinocerous

    updated = models.DateTimeField(auto_now=True)

    created = models.DateTimeField(auto_now_add=True)


Any help would be appreciated......


Regards

Sammi

--
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+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5100d863-f887-4b97-9ea4-95227ab99bdf%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/5100d863-f887-4b97-9ea4-95227ab99bdf%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56C7A494.4060103%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to