The centerpiece of the Django object-relational mapping scheme is the Model.
1
vote
0answers
4 views
conversion of datetime Field to string in django queryset.values_list()
I have a queryset like:
qs = MyModel.objects.filter(name='me').values_list('activation_date')
here activation_date is DateTimeField in models.
When I download excel sheet from this qs I am not ...
0
votes
0answers
10 views
Django models query parent objects issue
I have a question regarding models in Django.
I will explain how my models are structured. I have a model called AppUserGroup that is a group of users. This contains multiple users who I have called ...
0
votes
1answer
12 views
set minimum primary key for saving django models in database
I am new to Django.I have two models, Model A and a new Model B
class A:
firstname=models.CharField(max_length=20,blank=True,null=True)
email = ...
1
vote
2answers
18 views
Django ecommerce website huge product page intial load time (wait)
I'm just a starter in everything Django related so I apologize upfront for my confusing explanations. I've been trying to resolve some page load issues on a Django based website with an attached ...
0
votes
2answers
18 views
Copying Django model row data before updating
Before updating a row, I'd like to save its current results into another table. Currently I am using pre_save but it does not seem to work as intended. It gives me updated data, not pre-updated data.
...
1
vote
0answers
15 views
Django Models and Testing: Failed to install custom SQL
I have the following model:
from django.db import models
from django.forms import ModelForm
from vehicle.models import Vehicle
from account.models import Wheelster
class Ride(models.Model):
...
0
votes
1answer
15 views
Attempting to create a connection between two models in Django
I have two models, Event and Profile.
class Event(models.Model):
def __unicode__(self):
return self.title
event_id = models.BigIntegerField(blank = 'TRUE', primary_key='TRUE')
...
0
votes
1answer
14 views
Not able to send email to more than 2 email address
models.py
class FollowerEmail(models.Model):
report = models.ForeignKey(Report)
email = models.CharField('Email', max_length=100)
views.py
def what(request):
""""""
follower = ...
0
votes
1answer
23 views
send email to multiple email address
views.py
follower = FollowerEmail.objects.filter(user=report_id)
list=[]
for email in follower:
list.append(email.email)
''''''
''''''
if 'email' in request.POST:
...
0
votes
2answers
30 views
How to Dynamically Access Fields from Foreign Key in Django Admin
So I have models like this:
class Celebrity(models.Model):
#30+ fields here ...
class HoneyBadger(models.Model):
name = models.CharField(max_length=10)
celebrity_owner = ...
0
votes
1answer
12 views
Django Model: creating a new object on save for FK
In my Django Model I have the following FK on a class called Batch.
class Batch(models.Model):
sender_name = models.ForeignKey(Originator,
...
0
votes
1answer
33 views
Django ManyToMany relationship to queryset to pagination?
Here is the relevant code:
models.py
class Blog(models.Model):
...
images = models.ManyToManyField('myapp.Image')
class Image(models.Model):
...
title = ...
0
votes
1answer
14 views
send email to bcc and cc in django
views.py
if 'send_email' in request.POST:
subject, from_email, to = 'Parent Incident Notification',user.email, person.parent_email
html_content = ...
0
votes
0answers
12 views
Update a related Django model on save
I want to force a field on a related model to update when I perform a save.
Let's forget about whether this is a good idea or not, as I'm now just curious as to why my code appears to work but only ...
0
votes
1answer
10 views
Need clarification in Django mail sending scenario
I build a mail sending function in django.I did it by referring django Doc .
In doc to specify a email backend,need to add this line in settings.py
EMAIL_BACKEND = ...