Custom Query (27370 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (31 - 33 of 27370)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Ticket Resolution Summary Owner Reporter
#29473 needsinfo Postgres JSONField escaping to infinity on each save Laurynas Riliskis
Description

postgress JSONFields are escaping to infinity as you can see in the input below. The same behavior is reproduced through the admin interface.

I commented in bug https://code.djangoproject.com/ticket/26110 but not sure if the issue if the same.

import uuid
from django.db import models
from django.contrib.postgres.fields import JSONField

class PublishedConsent(models.Model):
    uuid = models.UUIDField(
            default=uuid.uuid4,
            editable=False)
    json = JSONField()
>>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60")
>>> p.data
'{}'
>>> p.save()
>>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60")
>>> p.data
'"{}"'
>>> p.save()
>>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60")
>>> p.data
'"\\"{}\\""'
>>> p.save()
>>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60")
>>> p.data
'"\\"\\\\\\"{}\\\\\\"\\""'
#29472 duplicate Natural key not serializing for primary_key OneToOneField nobody Ferd Snidely
Description

Serializing a model using a natural key that has a OneToOneField primary_key or parent_link fails to include the natural_key.

The problem occurs when serializing with use_natural_primary_keys=True, and use_natural_foreign_keys=True. The parent_link field is not included in the 'fields' structure in the json format (fails similarly for xml as well).

Equivalent to this unanswered stackoverflow: https://stackoverflow.com/questions/28702215/natural-key-serialize-django-model-with-one-to-one-field-as-primary-key

I have an example project at github/fsnidely/serialtest, which has an example model with tests.

An example of the expected serialized model with its natural_key ('thing'):

    {
        "model": "sandbox.product",
        "fields": {
            "thing": [
                "F-A"
            ],
            "prod_secs": 42,
            "low_level": -1
        }
    },

What is actually returned by serializers.serialize("json", ... or python manage.py dumpdata ...:

    {
        "model": "sandbox.product",
        "fields": {
            "prod_secs": 42,
            "low_level": -1
        }
    }

Notice that there is no PK or NK ('thing') for the object.

A simple parent model and child model inheriting parent model with a natural_key() is sufficient to reproduce the problem.

This problem appears to have existed in prior versions of Django as the referenced StackOverflow issue is over 3 years old.

#29470 duplicate Add output to makemigrations and migrate commands with --noinput nobody Kurt Wheeler
Description

The --noinput option to makemigrations seems to also mean "no output". It would be nice for scripting purposes if there could be some kind of output. When writing a script that helps manage migrations, it would be nice to be able to detect that the migrations needed input from the developer so that the script can fail gracefully and inform the developer that manual intervention is required. Right now the options seem to be to not use the --noinput options and have the prompt interrupt the script, or to use the option and have no idea when migrations failed because they required input.

I'm not very picky as far as how this functionality should be implemented goes. I would think that a little warning like "No migrations run because input was required but --noinput option was specified." would be sufficient. This could be output to stdout or stderr, either all the time or perhaps only if an additional option was set.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Note: See TracQuery for help on using queries.
Back to Top