Opened 15 years ago

Last modified 15 years ago

#10114 closed

spaces are inserted for 'blank' fields — at Version 1

Reported by: wmstudio Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords:
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 Ramiro Morales)

I have a model in which several fields are specified as follows:

    lat_dec = models.FloatField(blank=True, null=True)
    lon_dec = models.FloatField(blank=True, null=True)
    lat_dms = models.CharField(max_length=9, blank=True, null=True)
    lon_dms = models.CharField(max_length=10, blank=True, null=True)

In case of the CharFields, spaces are inserted into the database (PostgreSQL) when in the admin form the entry-fields are left blank. I found that out because I made some trigger procedures which update lat_dec and lon_dec when lat_dms and lon_dms (see model) are specified and vice versa. Now I made a workaround by adjusting the trigger procedure so it sets the fields to NULL when containing only spaces.

Change History (1)

comment:1 by Ramiro Morales, 15 years ago

Description: modified (diff)

(reformatted description)

Do these values stored in the database really contain space(s)? How many of them? Or are they empty strings?

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