Opened 11 years ago

Closed 6 years ago

#6233 closed Bug (duplicate)

fixture fails to load on inet field

Reported by: Michael P. Soulier <msoulier@…> Owned by: nobody
Component: Core (Serialization) Version: 0.96
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
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)

Using the admin interface I entered a couple of records for my model.

class TugInstance(models.Model):
    """This class represents a single instance of TUG in the multi-instance

    enabled = models.BooleanField(default=False)
    public_ip = models.IPAddressField(unique=True)
    wan_ip = models.IPAddressField(unique=True, blank=True, null=True)
    lan_ip = models.IPAddressField(unique=True)
    ready_for_calls = models.BooleanField(default=True)
    calls_in_progress = models.PositiveIntegerField()
    default_icp = models.ForeignKey(Icp)

    def __str__(self):
        return str(

    class Admin:

I am using postgresql-7.4.13-2.RHEL4.1 on CentOS 4.4.

I used the json serializer to dump json format of these records.

[root@vmware-espresso teleworker]# cat sample_data.json
[{"pk": "1", "model": "top.tuginstance", "fields": {"default_icp": 1,
"wan_ip": "", "ready_for_calls": true, "lan_ip": "", "enabled":
true, "public_ip": "", "calls_in_progress": 5}}, {"pk": "2",
"model": "top.tuginstance", "fields": {"default_icp": 2, "wan_ip":
"", "ready_for_calls": true, "lan_ip": "",
"enabled": false, "public_ip": "", "calls_in_progress": 0}}]

I then cleared the table manually, and tried to load this json as a fixture.

[root@vmware-espresso teleworker]# python --pythonpath=.. loaddata sample_data.json
Loading 'sample_data.json' fixtures...
Installing json fixture 'sample_data' from absolute path.
Problem installing fixture 'sample_data.json': invalid input syntax for type inet: ""

Seems that there are issues translating the json to sql that postgres will accept.

Change History (9)

comment:1 Changed 11 years ago by msoulier@…

Looks like it's the blank=True in the field type. Does this mean that I can't have a blank IPAddressField when using postgres?

comment:2 Changed 11 years ago by Michael P. Soulier <msoulier@…>

Seems to me that the Pg adapter is not accounting for this case correctly, and should be fixed.

I'll see if I can provide a patch.

comment:3 Changed 11 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:4 Changed 11 years ago by Ramiro Morales

Description: modified (diff)

comment:5 Changed 8 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:6 Changed 7 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:7 Changed 7 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:8 Changed 6 years ago by Claude Paroz

Duplicate of #5622 (or symptom of that issue).

comment:9 Changed 6 years ago by Claude Paroz

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top