Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
61 views

I'm trying to build dynamic connections to databases. This because I just now and then have to query them to get some data. The sources change over time, so I'm not in favor of adding them to settings....
Berik's user avatar
  • 83
0 votes
0 answers
60 views

loads_of_dedicated_customers = Load.objects.filter(customer__is_dedicated=True).exclude(load_status='Cancelled').values('customer__name').annotate(year=ExtractYear('drop_date'), week=ExtractWeek('...
Valeriu's user avatar
  • 41
0 votes
1 answer
219 views

I have a Django model MyModel class MyModel(models.Model): """My Model that stores date.""" date = models.DateField() In my API I am receiving a param, review_month ...
Noyan Aziz's user avatar
1 vote
1 answer
41 views

I have this model: class UserMovieRel(models.Model): user = models.ForeignKey("register.User", on_delete=models.CASCADE) movie = models.ForeignKey("Movie", on_delete=models....
Luke's user avatar
  • 1,844
0 votes
1 answer
56 views

I am trying to reference 2 fields from a particular django model but it keeps giving me error. The models are displayed below, i want to reference 'building_type' and 'location' from property table to ...
Dr. Ose Sunday's user avatar
1 vote
2 answers
975 views

SOLVED I'm working with sensitive currency values. In my case, i have to reproduce a sheet with it's formulas. The point is that i need to round down a currency value with 2 decimal places. A ...
Max's user avatar
  • 35
1 vote
1 answer
1k views

views company = Company.objects.get(id = company_id) # getting input from django urls (<int:company_id>) vehicles = CompanyContainVehicles.objects.filter(company_id=company.id) # Give all rows ...
shraysalvi's user avatar
1 vote
1 answer
2k views

Let's say I have two models that have one-to-many relationships as the code below. I'd like to only get order objects that have more than one shipment object. The only way I can think of is getting it ...
Lidia Kwon's user avatar
3 votes
0 answers
198 views

I have a queryset of users, after annotating the rank of each user using Django Window function, I want to query for a user without modifying the rank value users_points_query = users.order_by( ...
Mahdy H.'s user avatar
  • 309
3 votes
1 answer
57 views

I am trying to get down through multiple-foreign key relationship where each Hotel has many Rooms, each Room has many Rateplans, each Rateplan has many Prices. It resembles Christmas tree if you think ...
Kihaf's user avatar
  • 77
0 votes
1 answer
289 views

I have a python script for creating the tables and specifying the values that should be added to it. I use the following two commands to do the migration. python manage.py makemigrations python manage....
SameeraR's user avatar
  • 425
1 vote
2 answers
259 views

My models class Machine(models.Model): machineName = models.CharField(verbose_name="Machine Name", max_length=20, blank=False, null=False) class SalesReport(models.Model): machine = ...
Aravind OR's user avatar
1 vote
2 answers
536 views

drivers available with me **python shell** '''In [2]: pyodbc.drivers()''' **Output:** **Out[2]: ['SQL Server']** code in settings.py django: **Settings.py in django** '''# Database ...
harsha Machine_learning's user avatar
0 votes
1 answer
23 views

''' My problem is database values can't stored properly In below I uploded views functions file,model file as an images. so in model there are three fields but database stored only image stored and ...
gohil akash's user avatar
3 votes
1 answer
698 views

I want to bulk update a table with data two tables over. A solution has been given for the simpler case mentioned in the documentation of: Entry.objects.update(headline=F('blog__name')) For that ...
AlanSE's user avatar
  • 2,784
1 vote
1 answer
436 views

I have a model configuration as below, class Foo(models.Model): start = models.DateTimeField() end = models.DateTimeField() How can I retrieve Foo instances with same Year? Unsuccessfull try: ...
JPG's user avatar
  • 89.4k
0 votes
2 answers
113 views

I have a working code which gets all incident details. But i am unable to save complete data in database only the last record gets saved def incidents(request): incidentsServicenow = ...
Vyshnavi's user avatar
  • 149
0 votes
1 answer
289 views

I am trying to set up a Website for Employee Scheduling with Django. I am new to Web development, therefore I run into some problems, scince I have the feeling the Web handles things differently. I ...
Lukas Humpe's user avatar
24 votes
1 answer
17k views

Prologue: This is a question arising often in SO: Equivalent of PostGIS ST_MakeValid in Django GEOS Geodjango: How to Buffer From Point Get random point from django PolygonField Django custom for ...
John Moutafis's user avatar
1 vote
1 answer
4k views

I am learning Django and i need to know whether i can link a table already present in the database to a model (since, i heard that tables are created by Django for whatever models we are creating ...
sportymsk's user avatar
4 votes
0 answers
500 views

I have an event that occurs everyday. Here is the model class Event(models.Model): date = models.DateField() plays = models.IntegerField() viewers = models.IntegerField() time = ...
atkawa7's user avatar
  • 472
-3 votes
1 answer
31 views

I have questions related to SELECT statement for this case: For example there are 4 tables, which are StdCandidate, CourseChoice, Course, and EntranceTest. The tables are shown in the image --> enter ...
Mahendra Darmawiguna's user avatar
9 votes
4 answers
10k views

I have a Booking model that has start and end datetime fields. I want to know how many days a booking covers. I can do this in Python but I need this value for further annotations. Here's what I've ...
Oli's user avatar
  • 241k