Yes, it's a single query.
Take a look at django-debug-toolbar. It can display all SQL queries
that was executed during request/response so you'll always be sure
what's going on.
On 26 окт, 03:12, wancharle sebastiao quirino
wrote:
> Hello,
>
> I currently am using raw sql to make an atomic oper
It is very likely that your urls.py is wrong. Re-check if admin urls
are included exactly as in documentation example: "(r'^admin/', include
(admin.site.urls))", without any wildcards.
On 27 окт, 00:12, "M." wrote:
> Hi,
>
> I've installed the Admin interface, but the interface is unresponsive.
You should override change_form.html template and save it as
/your_project/templates/admin/your_app/change_form.html
or
/your_project/templates/admin/your_app/your_model/change_form.html
On 26 окт, 21:45, Aaron wrote:
> I need to add a button to the admin change form of certain models,
> whic
If you want to be able to sort by some python method you have to fetch
ALL data from all tables that are used in this method. It is indeed a
bad practice and so it is not encouraged in django.
The best you can do is to put your code to model's manager as a
method. Model managers are often used fo
Maybe I wrote a reply without undersanding what you need.
You have 2 separate issues:
1. Want to sort and filter by calculated field
2. Want to create calculated field that is calculated in python
Am I correct?
1) can be acheived using ".extra" method or aggregations
http://docs.djangoproject
I think if your methods are really complex then the best you can do is
to denormalise your DB.
Make your calculated fields real fields in a table and update them in
model's save method or using signals.
Another way is to make them calculated by DB using triggers or DB
views but I would prefer den
Performance monitoring doesn't have to be related to django itself.
There are external projects that cant do performance monitoring (CPU,
i/o, memory usage over time). You may give munin (http://
munin.projects.linpro.no/) a chance.
On Dec 10, 7:43 am, Kegan Gan wrote:
> Hi,
>
> Google App Engine
You may find this useful: http://bitbucket.org/barttc/django-generic-location
On 31 авг, 04:05, Joel Klabo wrote:
> I want to tie a location to each instance of a model. I am planning on
> getting the lat/long. from navigator.geolocation through javascript.
> My original idea is to have a locatio
Hi Rogério,
You can give http://bitbucket.org/kmike/django-qsstats-magic/src a
try.
It currently have efficient aggregate lookups (1 query for the whole
time series) only for mysql but it'll be great if someone contribute
efficient lookups for other databases :)
On 28 окт, 19:31, Rogério Carrasqu
ira
>
> ---
> e-mail: rogerio.carrasque...@gmail.com
> skype: rgcarrasqueira
> MSN: rcarrasque...@hotmail.com
> ICQ: 50525616
> Tel.: (11) 7805-0074
>
> 2010/10/28 Mikhail Korobov
>
>
>
> > Hi Rogério,
>
> > You can givehttp://bitbucket.org/kmike/django
Hi Yves,
In django 1.3 there is also a TemplateResponse (
http://docs.djangoproject.com/en/dev/ref/template-response/ ) that can
perform as render_to_response replacement, doesn't require class based
views and enables developer to change the template context (as well as
the template to be rendered
Hi Alex,
django-admin-tools should solve all your problems with admin index
page.
https://bitbucket.org/izi/django-admin-tools/
On 24 дек, 17:48, Álex González wrote:
> Hi!
>
> I have a lot of models in same app at my django app, can I group then
> another way that app order?
>
> I see:
>
> Aut
Hi Igor,
If you use django <= 1.2 the you can replace 'render_to_response' with
'direct_to_template'. They do almost the same but 'direct_to_template'
uses RequestContext by default:
from django.views.generic.simple import direct_to_template
def my_view(request):
# ...
return direct_to_t
production = Production.objects.all()
for product in production:
try:
product.image = product.image_set.get (somefield = somevalue)
except Image.DoesNotExist:
pass
{% for product in production %}
{{ product.title }}
{% endfor %}
or even better implement the 'get_i
Hi Rahul,
This can be solved using custom javascript. Override ModelAdmin's
changelist template (
http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#overriding-admin-templates
) in order to insert the necessary javascript code.
On 10 янв, 00:37, rahul jain wrote:
> How to map admin actions
Hi guys,
Designers often want to add some css classes and html attributes to
django form fields. But now they have to either patch the python code
or copy-paste full html widget output and then customize it. In order
to make them happy I just released an app (
https://bitbucket.org/kmike/django-w
It doesn't work that way. ORM translates you queries to SQL and the DB
is responsible for filtering. It is not possible to translate
arbitrary python function to SQL or pass it to DB engine. So you have
to formulate you query using .filter syntax or raw SQL.
Another possibility is to denormalize d
This is the function for getting 1 item that works even if some rows
were deleted that works times faster than order_by('?') even for not-
so-big datasets at least on mysql:
def get_random_item(model, max_id=None):
if max_id is None:
max_id = model.objects.aggregate(Max('id')).values()
Stackoverflow:
http://stackoverflow.com/questions/962619/how-to-pull-a-random-record-using-djangos-orm/971671#971671
On 22 фев, 03:06, Mikhail Korobov wrote:
> This is the function for getting 1 item that works even if some rows
> were deleted that works times faster than order_by('?
Why doesn't setattr work? Just make sure you're setting the proper
option because apps often cache options at e.g. their 'config.py' file
in order to provide default values:
# captha_app/config.py
from django.conf import settings
CAPTCHA = getattr(settings, 'CAPTCHA', True)
So you'll have to chan
20 matches
Mail list logo