django-postgresql Questions

2

I'm using Django's postgres-specific ArrayAgg aggregator. It works fine but when the list is empty I get [None] instead of []. Is there any way to filter these null values out? I've tried to pass a...

5

Solved

I'm in the midst of setting up my Django project on Heroku. I have been following the documentation, but when I foreman start I receive an error that I can't quite figure out. I have set up my engi...
Tiannatiara asked 27/9, 2014 at 23:57

2

Timezones are driving me crazy. Every time I think I've got it figured out, somebody changes the clocks and I get a dozen errors. I think I've finally got to the point where I'm storing the right v...
Ataghan asked 9/4, 2019 at 16:46

2

I have models sth like this # models.py class MyModel( models.Model ): orders = models.JsonField(null= True, blank=True, default=list) category = models.ForeignKey(Category, on_delete=models.CASC...

2

Solved

I'm currently working on a website right now on Django. On my computer, I am running it on Docker with a postgres database. Here's the docker-compose file I have: version: '3' services: db: imag...
Chokefull asked 24/7, 2020 at 3:17

4

Solved

I have a series of integration-level tests that are being run as a management command in my Django project. These tests are verifying the integrity of a large amount of weather data ingested from e...
Jenaejenda asked 30/9, 2016 at 14:41

1

Solved

I tried to run python3 manage.py migrate, but i got this error: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django /db/backends/utils.py", line 84...

1

I am trying to restrict GFK to be pointed to objects of a few models only, and I thought CheckConstraint will be a great way to do this, however I get this error class ManualAdjustment(Model): co...

3

Solved

I'm running a django-celery application on Ubuntu-12.04. When I run a celery task from my web interface, I get the following error, taken form postgresql-9.3 logfile (maximum level of log): 2013-...
Monadelphous asked 12/11, 2013 at 14:5

2

Solved

My model looks like this: from django.contrib.postgres.fields import ArrayField class Trigger(models.Model): solutions = ArrayField(models.TextField(blank=True, null=True), blank=True, null=True...
Caenogenesis asked 16/7, 2017 at 21:49

3

Is there a limit to the AutoField in a Django model or the database back-ends? The Django project I am working on could potentially see a lot of objects in certain database tables which would be i...
Warpath asked 27/8, 2012 at 23:36

1

Solved

I have model with postgres json field. class MyModel(models.Model): data = JSONField(null=True) then, I do: m1 = MyModel.objects.create(data={'10':'2017-12-1'}) m2 = MyModel.objects.create(da...
Amadaamadas asked 28/5, 2018 at 15:49

1

Solved

I'm currently using a single PostgreSQL database, with standard settings. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'postgres', 'USER': 'postgres',...
Lobule asked 1/5, 2018 at 22:18

2

I'm trying to figure out how to filter QuerySet using date extracted from datetime. I use Django-filter and I can't compose such lookup without iterating over QuerySet which is very uneffective. ...

1

Solved

I have a list of tuples like below - [(float.inf, 1.0), (270, 0.9002), (0, 0.0)] I am looking for a simple serializer/deserializer that helps me store this tuple in a jsonb field in PostgreSQL. ...
Forrester asked 20/1, 2018 at 13:53

2

Solved

So I'm trying to add a SearchVectorField to a model in Django: class JobPosting(models.Model): ... ... search_vector = SearchVectorField() I get that it should either be nullable or have a de...
Natatorium asked 6/4, 2017 at 15:44

2

Solved

I need to do a values/values_list query on nested key on a postgres backed jsonfield in django 1.10 eg. class AbcModel(models.model): context = fields.JSONField() If it has values like: { 'le...
Epidaurus asked 8/3, 2017 at 15:47

2

Solved

I am trying to add tags to a model for a postgres db in django and I found two solutions: using foreign keys: class Post(models.Model): tags = models.ManyToManyField('tags') ... class Tag(mode...
Overwind asked 6/6, 2017 at 6:18

2

I am using postgres with my django app and I had manually created the hstore extension in the database. But, when I run tests it tries to create a new database and fails when the hstore extension i...
Bemire asked 31/3, 2016 at 1:47

0

can someone ELI5 what CONN_MAX_AGE does? I thought it worked like this: 1) Request #1 comes in, opens connection 1 to database 2) Request #1 uses connection 1 to do some work 3) Request #1 compl...
Rollerskate asked 23/1, 2017 at 22:7

1

Solved

I am trying to fetch count of all distinct values in particular column for example I have following table in model name MyModel : Id City vendor 1 Mumbai 2 2 Pune 3 3 Mumbai 1 4 Yavatmal 2 ...
Distributive asked 30/4, 2016 at 10:17

0

I would like to use date_trunc SQL function but it it doesn't seem to work with timezones. Test 1 with Django : from django.db import connection cursor = connection.cursor() cursor.execute(""" SE...
Kieger asked 19/8, 2014 at 13:58

2

Solved

I am attempting to perform an order_by based a m2m field, but it ends up creating duplicate entries in my queryset. I have been searching through the django documentation and related questions on s...

2

Solved

Is there a maximum value as to how high pk values for a model can get? For example, for something like an activity feed model, the pk's can get really large. Ex, "Kyle liked this post", "Alex com...
Undermine asked 19/11, 2013 at 20:54

0

I have the following django admin exceprt: class TagAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("title",)} list_display = ['title', 'total_videos', 'total_active_videos', 'weight', ...
Lambskin asked 7/11, 2013 at 4:12

© 2022 - 2024 — McMap. All rights reserved.