Re: Using datetime.time object in form field choices

2011-09-12 Thread josephi
I also just realised that it's common to use an integer as the first element of a choice pair. Maybe the only restriction is that the datatype you use in the choice pair match the model field you're eventually saving it back to? On Sep 13, 3:20 pm, josephi wrote: > Hello > > I have a model Bookin

Using datetime.time object in form field choices

2011-09-12 Thread josephi
Hello I have a model Booking with a TimeField start_time on it. I want to ensure that times entered into this field are whole hours only. I've set up a ModelAdmin object to use this model in the admin interface. On the ModelAdmin I've used a custom ModelForm where I override the default field for

Caching/Reload problem - cannot refresh model data

2011-09-12 Thread puppriss
Greetings All, Now, you may think me a bit of an asshat for doing it this way, but I have a MySQL db backend, DJANGO admin, and a self-coded desktop application ('InsectApp') written in Python. The 2 apps, DJANGO-Admin & InsectApp, both use the same 'settings' file and access the same data

Newbie problem installing Django

2011-09-12 Thread fasteddie
I get the below error msg when I try to install Django 1.3.1 on a windows7 64bit machine. Django-1.3.1/Django-1.3.1/docs/topics/install.txt says Installing an official release ~~ 1. Download the latest release from our `download page`_. 2. Untar the download

Re: Alter the list of fields returned by a queryset without turning them into strings?

2011-09-12 Thread Jacob Kaplan-Moss
On Mon, Sep 12, 2011 at 8:41 PM, Joshua Russo wrote: > Do I just need to do a little more pre-processing in the view or can I > accomplish what I'm trying to do? The method you're looking for is ``only()`` (or perhaps its cousin, ``defer``): https://docs.djangoproject.com/en/dev/ref/models/query

Alter the list of fields returned by a queryset without turning them into strings?

2011-09-12 Thread Joshua Russo
I have 2 tables, document and event. I want to retrieve the document url and the event date but it seems like I can't do this in a single query set and that is then used directly in a template. This was my first thought: context = { 'minutes': Document.objects.filter(documentType=1, eve

Re: Using gedit for django development

2011-09-12 Thread Mario Gudelj
This is awesome dude. I was looking for something like this since I moved to Ubuntu. On 13 September 2011 10:12, Micah Carrick wrote: > I've written a blog post on using gedit, the default text editor in GNOME, > as a Django IDE. If you're a Linux user and you've never considered using > gedit f

Using gedit for django development

2011-09-12 Thread Micah Carrick
I've written a blog post on using gedit, the default text editor in GNOME, as a Django IDE. If you're a Linux user and you've never considered using gedit for development then this may be an interesting read for you. http://www.micahcarrick.com/gedit-as-a-django-ide-for-linux.html -- You receive

Re: Class-based FormView Contact Form

2011-09-12 Thread Paul Walsh
Hi Russ, Thanks for the input. I am actually looking to use FormView as opposed to UpdateView or CreateView because I am not working with model data at all: I want to create a simple contact form, and send the data of the form to a recipient via email - I don't want to write anything to the db

Interactions among values, annotate, and aggregation in django querysets

2011-09-12 Thread barry
I posted this in StackOverflow, and haven't gotten an answer there yet. I'm hoping someone here can answer my question. I don't know if this represents a django bug, or a lack of understanding on my part. Link: http://stackoverflow.com/questions/7276147/interactions-among-values-annotate-and-aggr

Re: Trouble expressing a query in the ORM

2011-09-12 Thread Stuart
On Sep 9, 8:28 am, Pewpewarrows wrote: > Tim Shaffer's response would have you doing N+1 queries, and having to loop > through all of your Target objects in-memory. Technically it would work, but > as soon as you have a decently sized amount of data in there it'd slow to a > crawl. > I just wante

New application : django-ajaxmiddleware

2011-09-12 Thread Adrien Lemaire
Hi django folks, I just wrote a middleware to handle ajax request really easily : https://github.com/Fandekasp/django-ajaxmiddleware I need some beta testers to give me some feedback, raise some bugs if my tests don't cover enough, etc. Thanks for your help, hope you'll like and adopt it as well

Re: Problems trying to use ManyToMany field before saving in a ModelForm

2011-09-12 Thread Ilian Iliev
My advice is to use custom model form and hide these M2M fields if you are creating a new object. You can overwrite the init method of the form to do this. On Mon, Sep 12, 2011 at 6:01 PM, Carlos Brum wrote: > Hello guys, > > I have a problem to deal with a field ManyToMany in Django. It is > th

Problems trying to use ManyToMany field before saving in a ModelForm

2011-09-12 Thread Carlos Brum
Hello guys, I have a problem to deal with a field ManyToMany in Django. It is the following: When I try to access a list of relations that is my ManyToMany field I get an error "%ModelName% instance needs to have a primary key value before a many- to-many relationship Can be used. " I need to p

Re: Implementing a List of Foreign Keys in a Model

2011-09-12 Thread Kurtis Mullins
Thanks a lot for that tip. I actually read over the Generic Foreign Keys several times before I asked the question but it still left me pretty confused. Is there a place I can see a good, straight-forward example of how this works? The "tags" example they had just didn't do it for me. Plus, they di

many to many in many relations

2011-09-12 Thread Nicklas
Hallo This question probably deserves a RTFM answer, but I have spent a few hours that I didn't have and would really appreciate a kick in the right direction. The thing is that I need to get registrations from colleagues. They need each of them to give a value per municipality, per month, per c

Re: Admin Site appending letter "s" to end of each model\table name

2011-09-12 Thread Casey Greene
I did not realize that my email client had not grabbed new mail from today and this was 2 days old. Sorry for the reply ad nauseum. Casey On 09/12/2011 09:24 AM, Casey Greene wrote: http://www.the-dig.com/blog/post/customize-plural-name-django-admin/ Casey On 09/10/2011 05:40 PM, Gillwill w

Re: Admin Site appending letter "s" to end of each model\table name

2011-09-12 Thread Casey Greene
http://www.the-dig.com/blog/post/customize-plural-name-django-admin/ Casey On 09/10/2011 05:40 PM, Gillwill wrote: Apparently the Django default is to append the letter "s" to the end of the model name for each listed under a given application on the Site Administration page. (It does this in t

Re: two independent Django sites, one user - share User objects

2011-09-12 Thread Donald Stufft
You could pick one site to be your canonical site, and add it as a second db to the first, and then use a custom authentication backend to auth against that site, then create a local user with the same password hash. On Monday, September 12, 2011 at 7:38 AM, Markus Gattol wrote: > Say I have

two independent Django sites, one user - share User objects

2011-09-12 Thread Markus Gattol
Say I have n (e.g. three) independent Django sites and one user. Rather than having n times a password/username I'd like to share this across all n sites. Also a users profile [0] and so forth. Now assume I don't want to use OpenID, how would I be able to have User objects in sync across n Djang

Re: Multitenant in Django

2011-09-12 Thread Cal Leeming [Simplicity Media Ltd]
This is similar to something we have used for one of our clients, except we used multihost.py :) +1 for this approach On Sun, Sep 11, 2011 at 3:49 PM, Alessandro Pasotti wrote: > 2011/9/9 sjtirtha > >> But I cannot set the SITE_ID in the settings.py right? >> Because if one user set the SITE_ID