Questions tagged [django-postgresql]

Use this tag for PostgreSQL issues which are to be solved in accordance with Django coding best practices.

207 questions
2
votes
0 answers

Django custom SQL operator

I am using Django 1.5.3 and PostgreSQL for my project. There are CIDR type fields in my tables and I wanted to model it in Django. I am using a CIDRField like ; class CIDRField(models.Field): def __init__(self, *args, **kwargs): …
Ahmet DAL
  • 4,445
  • 9
  • 47
  • 71
2
votes
0 answers

Isolating database when run multiple django test suites on Jenkins server

Our Jenkins test server runs several different test suites for a Django app, and several of these suites require that a Postgres database is present and seeded with data (e.g., integration tests, database migration tests). Currently, we have a…
Lorin Hochstein
  • 57,372
  • 31
  • 105
  • 141
2
votes
0 answers

why postgreSQL can't find foreign key

Why django reports a "missing foreign key error" when creating a record referencing a key just created ? have a look a this code: def doRegister(request,username, email, password): user = User.objects.create_user( username, email, password ) …
BiAiB
  • 12,932
  • 10
  • 43
  • 63
2
votes
1 answer

What's the right way to do a Django/South/PostgreSQL migration from calculated-as-needed summary values to maintained-in-database summary values?

My Django app has a User model, those Users have many Transactions. Some of my views display a summary (summation) of all transaction amounts, let's call it the 'total'. So far, this has been tallied up when needed for display. Now, I'd like to add…
gojomo
  • 52,260
  • 14
  • 86
  • 115
2
votes
2 answers

From MongoDB to PostgreSQL - Django

Could any one shed some light on how to migrate my MongoDB to PostgreSQL? What tools do I need, what about handling primary keys and foreign key relationships, etc? I had MongoDB set up with Django, but would like to convert it back to PostgreSQL.
Harry
  • 13,091
  • 29
  • 107
  • 167
2
votes
1 answer

Avoid RETURN postgresql statment in django1.4 and postgresql 8.1 related to bug #10467

A few days ago I write a project in django1.4 using the admin capabilities with the intention to make a CRUD for debug data migrated from a legacy system to a new system (the migration wasn't entirely successful), I write it using django 1.4 and…
1
vote
2 answers

Using field in Trunc's kind property

I use PostgreSQL in my project and have three related models: class Timer(models.Model): start = models.DateTimeField() end = models.DateTimeField() task = models.ForeignKey( Task, models.CASCADE, …
1
vote
0 answers

PostgreSQL table partitioning using Djano

Using PostgreSQL database and django-postgres-extra for creating a table partitioning in Django 4.2 application. The database settings are { "default": { "ENGINE": "psqlextra.backend", "NAME": "example1", "USER":…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
1
vote
1 answer

Django Queryset: group by two field values

I have a model like this Class ExchangeMarket(models.Model): base_currency = models.ForeignKey(Currency) quote_currency = models.ForeignKey(Currency) ... various other fields And some entries like base: EUR, quote: USD ... base: EUR, quote: USD…
1
vote
0 answers

Django - issue with displaying SearchHeadline object in a template

I am working on search functionality and I need to implement SearchHeadline to highlight searched words however I am struggling to do it in multiple fields. What I'd like to do is to highlight not only words in the title field but also the…
Adrian
  • 725
  • 4
  • 18
1
vote
0 answers

Django-postgres-extra package ENGIN error (table Partitioning)

i have two large tables in my database that change every day at 6AM , and I want to archive the most recent month , i decided to use table partitioning to store every day's data in partition , i installed django-postgres-extra and i'm getting this…
1
vote
2 answers

how to call function in django template using conditionals

I have a model for Group: class Group(models.Model): leader = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharField(max_length=55) description = models.TextField() joined = models.ManyToManyField(User, blank=True) …
1
vote
2 answers

Django ORM aggregate over related array field

I have two models class Record(Model): scorable_entry = models.ForeignKey('Entry', null=True, blank=True, …
Most Wanted
  • 6,254
  • 5
  • 53
  • 70
1
vote
0 answers

How i can use auto Attence system using by django and postgresql

i want to use functionality when the employee enters in office and mark the attendance with the help of button-like i have Attendance page where the employee hit the button the time store into Attendance-In Column and when the Employee left the…
1
vote
1 answer

Django validating time slot

This is my models to store availability of particular time when a new booking there class TimeSlot(models.Model): day = models.ForeignKey( Day, on_delete=models.CASCADE, related_name="time" ) booking = models.ForeignKey( Booking, …
user14751761