Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27519 closed Bug (invalid)

Issue in Django 1.8.5 model class — at Version 1

Reported by: Nitish Nandanan Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8
Severity: Normal Keywords: model class bug
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

Hi Team,

I am a Django developer. Here I am using Django 1.8.5 version to develop the application. I am facing one issue with Django model class.

Below is one sample model class which I am using in my application,

class Subgroup(models.Model):
    subgroupname = models.TextField(max_length=50,null=True,blank=True)
    description = models.TextField(null = True,blank = True)
    workgroup = models.ForeignKey(Workgroup)
    rowstamp = models.IntegerField(null=True, blank=True)
    active = models.BooleanField(default=True)
    group_leader = models.ForeignKey(UserProfile, null=True, blank=True)

    def __str__(self):
        return self.subgroupname

    class Meta:
        verbose_name_plural = "Subgroups"

The above model class is returning "Subgroup Name" as a value of that object. We have a our own admin interface area to enter this subgroup name and values for the above model class. If any invalid characters (eg:- '→' ) included in the subgroup name, Django will throw below error, while rendering this subgroup object in Django templates.

Error message:

** encoding, errors)\nUnicodeEncodeError: 'ascii' codec can't encode character u'\\u2013' in position 11: ordinal not in range(128)**

I think Django doesn't have any in-built error handling if any invalid characters included in the model value.

I am requesting you to check this issue on priority and suggest us a solution for this

Please let me know if you need any additional information

Thanks & Regards
Nitish Nandanan

Change History (1)

comment:1 by Tim Graham, 8 years ago

Description: modified (diff)
Resolution: needsinfo
Status: newclosed

Hi, there's aren't sufficient details here to point to a bug in Django. It seems more likely that you've made a mistake in your application. Please use our support channels to get help and reopen the ticket with more details if that investigation reveals that Django is at fault.

Note: See TracTickets for help on using tickets.
Back to Top