formset media

2010-02-16 Thread kkerbel
I'm having trouble getting AdminDateWidget to show in a formset. Is this possible? I've read and followed every post that mentions how to do this and I even have a page working with the AdminDateWidget, however, it uses a regular form and not a formset. I'm just having trouble getting it to

Re: comments in flatpages

2010-02-16 Thread shaner
got some of this working, i'll leave this here so the next guy that searches can find some info install flatpages and comments, that much is easily found in the django docs flatpages comes with a field for enabling comments per flatpage, I'm not sure how that control works yet this info below

comments in flatpages

2010-02-16 Thread shaner
anyone setup comments with flatpages? doesn't appear to be documented anywhere other than each individually, maybe nobody wants it to be too easy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: newbie: how do i filter a list in a template?

2010-02-16 Thread justin jools
I solved it after playing around for 3 hours it came to me: compare the make.id to model.dbforeignkey.id hope this helps someone :) {% for make in make_list %} make {{ make }} {% for model in model_list %} {% ifequal make.id model.dbforeignkey.id %} model {{

Re: Dictionary Model Merge

2010-02-16 Thread cootetom
Hi all, Thanks for every ones help on this. I have a fix now which is working well. from django.forms.models import model_to_dict values = model_to_dict(model_instance) for k, v in request.POST.copy().items(): values[k] = v form = FooForm(data = values, instance = model_instance)

Re: Setting initial data for an M2M field

2010-02-16 Thread Tom
Jacob, Thanks so much for this; it really helped me. Tom On Feb 16, 8:29 pm, Jacob Kaplan-Moss wrote: > On Tue, Feb 16, 2010 at 10:01 AM, Tom wrote: > > I can set other initial data, for example to the 'notes' CharField > > fine.  I guess my question

newbie: how do i filter a list in a template?

2010-02-16 Thread justin jools
models.py - for Car Manufacturer and Models class dbModel1(models.Model): dbfield1 = models.CharField("Product Manufacturer", max_length=200, unique=True) class dbModel2(models.Model): dbforeignkey = models.ForeignKey(dbModel1) dbfield1 = models.CharField("Model",

Browser games in Django

2010-02-16 Thread Timothy Kinney
Django seems to be an ideal platform for creating browser games, ie lightweight MMORPGs. Searching the archives I found some references to others doing this in 2007 and 2008. Is anybody aware of any current projects (especially open source) that use Django to publish browser game content? Also,

Re: Dictionary Model Merge

2010-02-16 Thread pjrhar...@gmail.com
> values = model_to_dict(instance) > values.update(request.POST) > > It then fails on form.is_valid() because it's trying to match a date > string in a date value that is actually a list with one value in it > instead of a date string! I can see two problems here. Firstly, the post "dictionary"

Re: converting month string

2010-02-16 Thread fchow
You can use the python time module in the standard library import time month_int = time.strptime(month_str, "%b").tm_mon The %b formatter assumes your month_str is a valid abbreviated month str (e.g. 'apr'). Check the time docs here: http://www.python.org/doc/2.5.2/lib/module-time.html On Feb

Re: AJAX Autocompletion Field

2010-02-16 Thread DrBloodmoney
I'll just point out that the jQuery Autocomplete plugin is included (will be included) in the next jQueryUI release. I think it's been pretty easy to hook into views On Feb 15, 2010 6:00 AM, "Massimiliano della Rovere" < massimiliano.dellarov...@gmail.com> wrote: I'd use http://dajaxproject.com/

Re: custom template tags used in an included template

2010-02-16 Thread Joel Stransky
Sorry, I meant custom filters, myModel.image|my_media_path On Tue, Feb 16, 2010 at 4:57 PM, Joel Stransky wrote: > I have a base.html template which includes a mainContent.html template. > mainContent reads a relative image path from the model passed to it but has > a

custom template tags used in an included template

2010-02-16 Thread Joel Stransky
I have a base.html template which includes a mainContent.html template. mainContent reads a relative image path from the model passed to it but has a custom template tag used for locating the start of the path which makes it easy to develop locally and deploy the project without having to change

Re: django template blocks and jquery

2010-02-16 Thread Joel Stransky
That was my first thought too David but the %} both closes the js method declaration and causes a syntax error. Turns out however that you can have more than 1 domready function so I just enclosed the global ones in a new .js file and appended a completely new $(document).ready() function in the

Re: problems posting data in a test

2010-02-16 Thread Paul Rubel
Hi Karen, Karen Tracey writes: > On Fri, Feb 12, 2010 at 3:38 PM, Paul Rubel wrote: > > > [snip] > > I can't get a test.client.Client.post()s raw_post_data to match what I > > get using my browser and the test throws an exception about reading > > more than the

Thread safe language switching?

2010-02-16 Thread Plovarna
Hello, I just developing my first aplication with internationalization. I need to get all verbose_name values of the model for each language defined in settings.LANGUAGES. I do it by this code defined inside model method : current_lang = get_language() names = {} for lang in

Re: how to set default value as current time in TimeField

2010-02-16 Thread Matt Schinckel
On Feb 16, 10:43 pm, Masklinn wrote: > On 16 Feb 2010, at 13:29 , Matt Schinckel wrote: > > > On Feb 16, 5:37 pm, Masklinn wrote: > >> On 16 Feb 2010, at 08:13 , harryos wrote: > > >>> hi > >>> I am using a TimeField and want to set the default value

Re: Setting initial data for an M2M field

2010-02-16 Thread Jacob Kaplan-Moss
On Tue, Feb 16, 2010 at 10:01 AM, Tom wrote: > I can set other initial data, for example to the 'notes' CharField > fine.  I guess my question boils down to: how do you set initial data > for a many-to-many field? The initial data for a many to many field needs to be a list.

Re: django template blocks and jquery

2010-02-16 Thread David Zhou
There are a couple of ways, but here's one off the top of my head: Base template: $(function(){ function1() { ... } function2() { ... } {% block additional_domready %}{% endblock %} }); {% block additional_js }%}{% endblock %} child template that extends base template: {% block

Re: Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Thanks Thanos, that answered my question! Btw, which plan do you have your site on? I was going to suggest a Shared 4 with extra RAM. On Feb 16, 1:17 pm, thanos wrote: > I would use Django's current behavior. This defaults to using  64K > chunks when a file is bigger that

django template blocks and jquery

2010-02-16 Thread Joel Stransky
Still very new to django so excuse the newbish questions. This might be obvious but I need a smart solution. I have a template that runs a jquery function at document ready which defines a few other functions. I only need a couple of these functions in the template I'm extending, the other I

Re: can't authenticate in template

2010-02-16 Thread paul
On Feb 13, 1:38 am, pbzRPA wrote: > Just as a suggestion, if you don't need to customize the get_user() > method then simply don't have a get_user() method in your custom > authentication class. Great, thank you for helping me out. I actually didn't realize there was a

Re: remote desktop control using Django

2010-02-16 Thread Baurzhan Ismagulov
On Tue, Feb 16, 2010 at 10:35:46AM -0800, Mike Ramirez wrote: > > This is very impractical to implement with pure browser + HTTP. > > Take a look at eyeos. http://eyeos.org/ PHP+Javascript... Wow, very impressive! Someone seems to have done the tedious work, and it performed well on my old

Re: Need help understanding a custom upload example

2010-02-16 Thread thanos
I would use Django's current behavior. This defaults to using 64K chunks when a file is bigger that FILE_UPLOAD_MAX_MEMORY_SIZE. Since 64k chunks should be small enough for Webfaction. You just need to set FILE_UPLOAD_MAX_MEMORY_SIZE in the settings.py to something low such as 102500 (100K).

Re: Object data change approvals.

2010-02-16 Thread esatterwh...@wi.rr.com
You could use contrib.contenttypes framework to do this pretty easily provided the models you will be working with have a similar structure; they all have a field called 'content' for example that would be editable. You can have a model that is the intermediate which has a generic foreign key

Re: Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Hi Michael, I'm familiar with using with. The documentation states that it's usually easiest to use chunks of a file to prevent memory over use. My client's site needs to run in a shared environment at WebFaction, so I'm just trying to limit memory use on these file uploads as much as possible.

Re: remote desktop control using Django

2010-02-16 Thread Mike Ramirez
On Tuesday 16 February 2010 10:24:46 Baurzhan Ismagulov wrote: > This is very impractical to implement with pure browser + HTTP. Take a look at eyeos. http://eyeos.org/ PHP+Javascript... Dunno if it's design is impractical but you can play with it here: http://eyeos.info/ If you find

Re: remote desktop control using Django

2010-02-16 Thread Baurzhan Ismagulov
On Tue, Feb 16, 2010 at 02:18:24AM -0800, Keyan wrote: > The software i'd like to write is a kind of " remote desktop control", > it has:one server and many clients > > server task is to control client's sytem & could able to handle > keyboard and mouse events of the client system. So you have

Re: Need help understanding a custom upload example

2010-02-16 Thread msmith64
I'm wondering where you got the idea that your custom handler is a function that goes into your view. From what I'm reading (http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload-handlers) it looks like a custom handler needs to be a class that implements at least

Re: Admin Javascript

2010-02-16 Thread When ideas fail
Thanks, got it working using that method after abit of messing. On 16 Feb, 14:01, Xavier Ordoquy wrote: > Hi, > > > Hi, I've been trying to use TinyMCE in my admin pages, I've followed > > this tutorial but so far have had no luck. > >

Re: send_mail not sending e-mail in view, but does send e-mail in shell

2010-02-16 Thread creecode
Hello Heleen, I don't have any specific solutions for you. In several of my projects I have views that do deliver email without issue. A couple of things come to mind. Have you checked that the arguments passed to send_mail in your view are correct? Is it possible that there is some kind of

Re: Django Generator

2010-02-16 Thread Brice Leroy
2010/2/13 Philippe Ombredanne : > Brice: > Very nice start. > There is a long history of similar tools and they all have a place and > a purpose. > I remember fondly of some tool that generated CRUD dbase apps from a > db schema .. that was last century ... > So carry on!

Re: Noob question: Templates: How to count for loop?

2010-02-16 Thread mhulse
Many thanks for the help rebus_ and Daniel! All of your suggestions, code samples, and links have been extremely helpful. I appreciate it. Have a great day! Cheers, Micky -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Passenger 57 - a Django query problem

2010-02-16 Thread bruno desthuilliers
On Feb 16, 4:54 pm, Emily Rodgers wrote: > On Feb 16, 3:39 pm, bruno desthuilliers > > wrote: > > On Feb 16, 2:56 pm, Derek wrote: > [snip] > > Ain't that "memberships" relationship redundant with

Re: Admin Javascript

2010-02-16 Thread When ideas fail
I got it working after abit of messing using the newforms-admin section instructions: http://code.djangoproject.com/wiki/AddWYSIWYGEditor#Withnewforms-admin I didn't look at django-tinymce. Thanks, Andrew -- You received this message because you are subscribed to the Google Groups "Django

Setting initial data for an M2M field

2010-02-16 Thread Tom
Hi all, I have two models, a contact model: class Contact(models.Model): company = models.ForeignKey(Company) first_name = models.CharField(max_length=200) last_name = models.CharField(max_length=200) title = models.CharField(max_length=200)

Re: remote desktop control using Django

2010-02-16 Thread bruno desthuilliers
On Feb 16, 12:05 pm, Keyan wrote: > Iam new to web application so i dont have clear view of HTTP protocol. Strange enough, I kinda guessed this already... FWIW, it seems you don't have a clear view of what "controlling the client's system" imply neither. I'll give you a

Re: Passenger 57 - a Django query problem

2010-02-16 Thread Emily Rodgers
On Feb 16, 3:39 pm, bruno desthuilliers wrote: > On Feb 16, 2:56 pm, Derek wrote: [snip] > Ain't that "memberships" relationship redundant with passenger->flight- > > >operator->memberships ? I reckon he probably wants to do is split

Re: Admin Javascript

2010-02-16 Thread Aljosa Mohorovic
On Feb 16, 2:42 pm, When ideas fail wrote: > Hi, I've been trying to use TinyMCE in my admin pages, I've followed > this tutorial but so far have had no luck. > > http://code.djangoproject.com/wiki/AddWYSIWYGEditor Have you tried django-tinymce?

Re: Passenger 57 - a Django query problem

2010-02-16 Thread Emily Rodgers
On Feb 16, 1:56 pm, Derek wrote: > (not a movie trivia problem!) > > The question I need to resolve here is "does Passenger 57 qualify for a > discount"? > > Given the following models: > > class Alliance(models.Model): >     name = models.CharField(max_length=100) >    

Re: Passenger 57 - a Django query problem

2010-02-16 Thread bruno desthuilliers
On Feb 16, 2:56 pm, Derek wrote: > (not a movie trivia problem!) > > The question I need to resolve here is "does Passenger 57 qualify for a > discount"? > > Given the following models: > > class Alliance(models.Model): >     name = models.CharField(max_length=100) >    

Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Hi Everyone, I'm confused about creating a custom upload handler and how it ties into my model. From the docs, this is an example of a custom upload handler, which I'm assuming goes in my view, or is accessed from my view: def handle_uploaded_file(f): destination = open('some/file/name.txt',

Multiple user types

2010-02-16 Thread Sander
Hello everybody, I'm kinda new to Django, and just finished reading the Django book. Now I was wondering the following when it comes to user management. In the Django documentation I found that storing additional information is acomplished by writing a new model and add a foreign key to the

Re: Preventing "...and it's related items will be deleted" in Django Admin?

2010-02-16 Thread greatlemer
On Feb 16, 1:20 pm, Derek wrote: > Is there a secure method to override the facility for "and it's related > items will be deleted" for a specific model in the Django Admin? > > In some cases it is not appropriate that the "parent" model is deleted until > all the "child"

Updating a PO file with makemessages without removing previous translation strings

2010-02-16 Thread Tim Langeman
I'm having trouble appending new translation strings to an existing po file without removing some of the previously translated strings. Here's some background: - I have a project that I've divided into sections. I have removed some templates from a section

Re: Admin Javascript

2010-02-16 Thread Xavier Ordoquy
Hi, > Hi, I've been trying to use TinyMCE in my admin pages, I've followed > this tutorial but so far have had no luck. > > http://code.djangoproject.com/wiki/AddWYSIWYGEditor I also followed this tutorial and had few issues. I went for this solution:

Passenger 57 - a Django query problem

2010-02-16 Thread Derek
(not a movie trivia problem!) The question I need to resolve here is "does Passenger 57 qualify for a discount"? Given the following models: class Alliance(models.Model): name = models.CharField(max_length=100) #e.g. Star, Western, Pacific, European discount = models.FloatField()

Re: Multi-table Inheritance and Admin

2010-02-16 Thread Stodge
If you want tags, use the django-tagging application. On Feb 16, 6:36 am, Alper KANAT wrote: > Hey There, > > I've two models: > Entryand > Tag . I think Tag >

Admin Javascript

2010-02-16 Thread When ideas fail
Hi, I've been trying to use TinyMCE in my admin pages, I've followed this tutorial but so far have had no luck. http://code.djangoproject.com/wiki/AddWYSIWYGEditor I tried using this method (http://beshrkayali.com/posts/4/) , that incoporates the Javascript directly into the templates and that

Preventing "...and it's related items will be deleted" in Django Admin?

2010-02-16 Thread Derek
Is there a secure method to override the facility for "and it's related items will be deleted" for a specific model in the Django Admin? In some cases it is not appropriate that the "parent" model is deleted until all the "child" models have been, for example, reallocated to new parents. If

Re: how to set default value as current time in TimeField

2010-02-16 Thread Masklinn
On 16 Feb 2010, at 13:29 , Matt Schinckel wrote: > > On Feb 16, 5:37 pm, Masklinn wrote: >> On 16 Feb 2010, at 08:13 , harryos wrote: >> >> >> >>> hi >>> I am using a TimeField and want to set the default value as current >>> time.I know the field normalizes to a

Re: how to set default value as current time in TimeField

2010-02-16 Thread Matt Schinckel
On Feb 16, 6:00 pm, Masklinn wrote: > On 16 Feb 2010, at 08:51 , harryos wrote: > > > thanks ,that worked.. > > > any idea about calculating the duration? I can do a - between two > > datetime.datetime objects to get a timedelta.. but that doesn't work > > with

Re: How do I manually set the "GROUP BY" for a django queryset?

2010-02-16 Thread Russell Keith-Magee
On Tue, Feb 16, 2010 at 4:43 AM, Greg Brown wrote: > Ok, here goes: > > First, some background - UserProfile is the > settings.AUTH_PROFILE_MODULE and the Application model has a > ForeignKey to User. There's ~90,000 users/userprofiles, ~110,000 > applications (most

Re: remote desktop control using Django

2010-02-16 Thread Jonas Obrist
If you're new to web apps I strongly suggest you'll have a go at something easier than what you plan. Generally you could do what you intend with django, since the crazy stuff is going to be in the frontend (flash?). -- You received this message because you are subscribed to the Google Groups

Re: how to set default value as current time in TimeField

2010-02-16 Thread Matt Schinckel
On Feb 16, 5:37 pm, Masklinn wrote: > On 16 Feb 2010, at 08:13 , harryos wrote: > > > > > hi > > I am using a TimeField and want to set the default value as current > > time.I know the field normalizes to a datetime.time object.In a > > DateField ,I can put

Re: Custom Admin Form for ManyToMany, missing Green Plus Sign?

2010-02-16 Thread Matt Schinckel
On Feb 14, 3:49 pm, john wrote: > > Yes, the Items model data can be accessed through another part of the > Admin interface, but I think the purpose of the Green Plus Sign was to > alleviate this extra step. Try registering the model of that type with the admin. The

Multi-table Inheritance and Admin

2010-02-16 Thread Alper KANAT
Hey There, I've two models: Entryand Tag . I think Tag model as a generic model to use with other models but not an abstract model since it can be used standalone too. Any way, what

Re: remote desktop control using Django

2010-02-16 Thread Keyan
Iam new to web application so i dont have clear view of HTTP protocol. If that remote descktop control is possible using django means please let me know how to proceed with.. thank u On Feb 16, 3:41 pm, bruno desthuilliers

Re: remote desktop control using Django

2010-02-16 Thread bruno desthuilliers
On Feb 16, 11:18 am, Keyan wrote: > The software i'd like to write is a kind of " remote desktop control", > it has:one server and many clients > > server  task is to control client's sytem &  could able to handle > keyboard and mouse events of the client system. > > Please

remote desktop control using Django

2010-02-16 Thread Keyan
The software i'd like to write is a kind of " remote desktop control", it has:one server and many clients server task is to control client's sytem & could able to handle keyboard and mouse events of the client system. Please let me know is it possible to do using Django! Thank you -- You

Re: Union of two querysets?

2010-02-16 Thread Nick Booker
Yes you can do a union. Use the "|" (pipe) operator. union = queryset1 | queryset2 or you can replace queryset1 with the union as follows: queryset1 |= queryset2 Nick On 16/02/10 02:39, rebus_ wrote: On 16 February 2010 03:28, ydjango wrote: I have two query sets

Re: Dictionary Model Merge

2010-02-16 Thread cootetom
Have tried model.__dict__ and model_to_dict. In both cases it often returns values as objects instead of string values. For instance, a date comes back as a list, so does a text field. Then I'll receive an error like this: Environment: Request Method: POST Request URL:

Abstract class related_name deppendent from application

2010-02-16 Thread gentlestone
Hi everyone, I have an abstract base class which has foreign key. Derived classes should have a related_name="%(class)s..." But, what if I have two or more derived classes with the same name in different applications? What is the solution of this issue? Patch this piece of code in

Re: Dictionary Model Merge

2010-02-16 Thread Daniel Roseman
On Feb 15, 10:31 pm, cootetom wrote: > Thanks Javier but I'm having problems with that. I do want to create a > dictionary from the model first then override with the POST values. > But when I try to make a dictionary from the model I get an 'object is > not iterable' error.

Re: Noob question: Templates: How to count for loop?

2010-02-16 Thread Daniel Roseman
On Feb 16, 2:12 am, mhulse wrote: > > You could do it like this. There was a discussion recently about mod > > operator and what happens when you want to do something every N times > > but can't find it now for some reason :( > > Ah, interesting! Thanks for the code sample, I

Using dajaxice to get my data to javascript

2010-02-16 Thread Alexis Selves
Hello there, Is possible to get my data from Django using Dajaxice? I need get information to create markers on google maps. Thanks for your advices. Alex. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: how to set default value as current time in TimeField

2010-02-16 Thread Masklinn
On 16 Feb 2010, at 08:51 , harryos wrote: > > thanks ,that worked.. > > any idea about calculating the duration? I can do a - between two > datetime.datetime objects to get a timedelta.. but that doesn't work > with datetime.time objects Nope, seems datetime.time doesn't define __add__ and