Re: Admin TabularInline Edit Parent Record?

2011-09-06 Thread Uros Trebec
I would like this very much, if someone has any ideas on how to achieve it. -- Uros On Sep 6, 4:35 am, Lee wrote: > I use TabularInlines for Many-to-Many join tables, with the foreign > keys appearing in select lists. The Admin interface automatically > provides the stellar "Add-Another" icon (a

Re: Authorization workflow model

2011-09-06 Thread Julien Castets
Hi, I faced to the same problem than you a few weeks ago, and I found this : https://github.com/dominno/django-moderation#readme It seems to be what you're searching. On Tue, Sep 6, 2011 at 5:55 AM, Mike Dewhirst wrote: > On 6/09/2011 5:46am, Mario8k wrote: >> >> Hello, >> >> Does anyone knows

Re: Use primary key in filenames on FileFields

2011-09-06 Thread Stratos Moros
This wouldn't work. It will work for updates, but when a new Decision object is created, "get_file_path" runs before the object is saved and self.id will be None. On Sep 5, 6:51 pm, Bingimar wrote: > try this > > def get_file_path(instance, filename): >     path = 'your upload directory' >     ex

Re: forms.ChoiceField/forms.ModelChoiceField Needs a Lot of Love

2011-09-06 Thread Reinout van Rees
On 05-09-11 23:09, Terribyte wrote: I don't know if anyone has said this outright, but I think that ChoiceField and ModelChoiceField are just broken. It seems that every time I want to do something with them I'm having to write a custom init function get what I want done. As a community I think

How to group models month by month.

2011-09-06 Thread Yaşar Arabacı
I have a model with datetime field. I want to get a table with three columns as, year, month and number of items in time span. And I also want to order them from newest to oldest. What I want to get is something like this: 2011 August 4 2011 March 7 How do you suggest I should do that? I am tryi

Re: How to group models month by month.

2011-09-06 Thread Andre Terra
http://django.me/aggregation Cheers, AT 2011/9/6 Yaşar Arabacı > > I have a model with datetime field. I want to get a table with three > columns as, year, month and number of items in time span. And I also want to > order them from newest to oldest. What I want to get is something like this:

Re: How to group models month by month.

2011-09-06 Thread Yaşar Arabacı
I already read that, but I can figure out it is something to do with my question, bu can't figure out what exactly should I do with aggreates. I ended up doing something like this: query_set = Post.objects.all() years = query_set.dates("pub_date","year") date_hierarchy = {} for year

Pagination of more than one field

2011-09-06 Thread OC
Hi, I am new to django and I have a pagination question: In my web page I need to display 2 query results of two different tables Each result is displayed in a different div in the same page. How can I implement "multiple" pagination meaning that each result is displayed in its own panel and has

Session value persistence between views

2011-09-06 Thread alaric
Hi: I am very new to Django but I am trying to authenticate using Django's session framework. Problem is: I need the raw password to ssh as that user to retrieve data on another machine. I haven't gotten it to work however. I have a login view that looks like: def login(request): request.sess

Re: Pagination of more than one field

2011-09-06 Thread Yaşar Arabacı
I think your question can be solved with javascript and ajax, rather than with django. How is your knowledge in that area? 2011/9/6 OC > Hi, > > I am new to django and I have a pagination question: > In my web page I need to display 2 query results of two different > tables > Each result is disp

Re: Too many TCP connections

2011-09-06 Thread shacker
Thanks for all the responses on this. After watching the error logs on the production server I saw tons of infinite redirect loops on calls for admin_media: "GET /admin_media/js/jqu///404.shtml/ HTTP/1.1" 302 - ... This wasn't immediately apparent since the admin *seemed* to look and w

Re: Too many TCP connections

2011-09-06 Thread Cal Leeming [Simplicity Media Ltd]
Lmao, nice. Glad you got the issue resolved! On Tue, Sep 6, 2011 at 8:04 PM, shacker wrote: > Thanks for all the responses on this. After watching the error logs on the > production server I saw tons of infinite redirect loops on calls for > admin_media: > > "GET /admin_media/js/jqu///4

Initial data for ManyToMany field

2011-09-06 Thread Thomas49
Hello, I have two models, and the second contains a ManyToMany relationship: class TypeMedical(models.Model): ... class Symptome(TypeMedical): ... parent = models.ManyToManyField(TypeMedical,related_name='Parent',blank=True) ... Then, I use a ModelForm in order to save data. cla

Re: Initial data for ManyToMany field

2011-09-06 Thread Nan
Because SymptomeForm is a ModelForm, it will initialize its "parent" field as a ModelMultipleChoiceField, which I believe must be initialized with a queryset instead of a list. On Sep 6, 4:30 pm, Thomas49 wrote: > Hello, > > I have two models, and the second contains a ManyToMany relationship: >

multiple filters on the same (reversed) foreignkey leads to multiple join

2011-09-06 Thread dvd
A clean project/app in django 1.3 with just two models from django.db import models class Base(models.Model): pass class Child(models.Model): base = models.ForeignKey(Base) flag1 = models.BooleanField() flag2 = models.BooleanField() A Queryset with a single use of `.filter` work

Re: How to group models month by month.

2011-09-06 Thread Mengu
this is overkill. the query you actually need is this (there even can be a better way): SELECT DATE_FORMAT(pub_date, "%Y %M") as pub_date, COUNT(*) as count FROM app_posts GROUP BY pub_date ORDER BY count DESC i have no idea how to pull this query by the Django ORM but you can run this as a raw q

Static images for use in admin widget

2011-09-06 Thread Micky Hulse
Hello, Within an admin field widget that I am developing, I need to access a static image from my app. For example, I have a Google map and I would like to access "crosshair.gif" from the apps' static folder (er, the collectstatic folder). Inside the widget's render() function, I have a formatte

Re: Initial data for ManyToMany field

2011-09-06 Thread Tomas Neme
Look into formsets. It's what the admin inlines use. On Tue, Sep 6, 2011 at 5:40 PM, Nan wrote: > > Because SymptomeForm is a ModelForm, it will initialize its "parent" > field as a ModelMultipleChoiceField, which I believe must be > initialized with a queryset instead of a list. > > On Sep 6, 4

Re: Initial data for ManyToMany field

2011-09-06 Thread Tomas Neme
> Look into formsets. It's what the admin inlines use. that is class TypeMedicalForm(forms.ModelForm): class Meta: model = TypeMedical TypeMedicalFormSet=formset_factory(TypeMedicalForm) take a look at the django docs for more details -- "The whole of Japan is pure invention. There is no

Re: Pagination of more than one field

2011-09-06 Thread OC
I am familiar with js but not with ajax I thought that django supports these kind of matters ... isnt it trivial? Attached the code Please advise {% for movie in movies.object_list %#} {{movie.name}} {% e

Re: Static images for use in admin widget

2011-09-06 Thread Tomas Neme
> Inside the widget's render() function, I have a formatted string that > contains embedded JS, and within that string I have a JS function that > looks like: > > function showCrossHair(divId) { >... >div.innerHTML = ''; >... > }; this looks awful to me. Can't you stick tha

Re: Static images for use in admin widget

2011-09-06 Thread Micky Hulse
On Tue, Sep 6, 2011 at 10:54 PM, Tomas Neme wrote: > this looks awful to me. Can't you stick that into a .js file and include > that? Doh, yah... If my django-fu skills were better, then maybe I could! :) I should have posted the original code: I am m

django and thrift

2011-09-06 Thread leon
Hi, I have one question. Is it possible to use Django to write thrift (http://thrift.apache.org/) formated web service? If it is possible, is there any sample? Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

intercept calls to reverse(..) in tests

2011-09-06 Thread Reikje
Hi, I have a bunch of WebTest's which are using the reverse method from django.core.urlresolvers to resolve a URL which the test should call. Example: url = reverse('webapp_home') form = self.app.get(url).form Now I need to add a query parameter to every url. This is to mimic a Facebook request w