I am facing a problem with my project, I posted about it on Stack Overflow,
here is the link:
http://stackoverflow.com/questions/28539441/reference-objects-using-foreign-keys-in-django-forms
Here is m code on github, I am currently working on the feature_forms
branch: https://github.com/keta
Take a look at the `extra` method of the queryset in Django. It allows you to
do what you are trying to do by raw SQL.
https://docs.djangoproject.com/en/1.9/ref/models/querysets/#django.db.models.query.QuerySet.extra
Check the above link, the example with `annotate` will be interesting for you.
Can you not do something like
`qs.filter(...info that is coming in...).exists()`
If ^ is True, then update it, otherwise create a new object?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving em
Hey Erik,
What Django version are you on?
On Tuesday, May 24, 2016 at 1:28:57 AM UTC+5:30, Erik Cederstrand wrote:
>
> Hi,
>
> I have inherited a legacy Item model that has a composite unique key
> consisting of a Customer ID and a per-customer, incrementing Item ID.
> Assume I can't change th
The official tutorial is difficult for a beginner, it was for me.
I would suggest you start with Django girls, or "Tango with Django"
On Thu, May 26, 2016, 5:52 PM Jani Tiainen wrote:
> And after that official tutorial there exists Django Girls and Django
> Taskbuster which are much more verbos
It just means the "field_name" you are using in the filter query doesn't
exist.
Multiple reasons:
1. The model doesn't really have that field in its definition.
2. You forgot migrating your database.
3. The field name being sent from your form is not right.
To get a clearer picture, try the same
This is how you can compress the images while saving:
```python
import urllib2
import cStringIO
from boto3.session import Session
from PIL import Image
aws_session = Session(
aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
region
I am storing links of these images as I need to show them on the frontend,
not connected to any user.
But I have done what you are talking about too.
So Django gives you a Model File Field. Add that to your Model. That will
allow you to save and store files. While saving a model object, just use
t
I have a method that updates a row in the table.
To avoid race condition, I locked the row using `select_for_update` inside
an `atomic` block and doing the update.
This method is called from a celery task.
This works well on my local machine. But when this gets called on my
production server (two
eads/writes to another db?
>
> Cheers,
> Simon
>
> Le samedi 25 mars 2017 15:08:19 UTC-4, Ketan Bhatt a écrit :
>
> I have a method that updates a row in the table.
> To avoid race condition, I locked the row using `select_for_update` inside
> an `atomic` block and doing t
10 matches
Mail list logo