Re: Need help on jquery Ajax load(use load two times)

2009-12-04 Thread Nicu Marcu
Thanks for you answer. i resolve my problem with callback. I put the second load in the first loaf callback function, and works OK. 2009/12/4 Daniel Roseman > On Dec 4, 9:52 am, NMarcu wrote: > > Hello all, > > > > I have a strange problem

Re: admin templates issue

2009-12-04 Thread Sam Lai
2009/12/4 gentlestone : > I've tried to folow the tutorial and customize the admin template and > made a copy of 'change_form.html' template into the 'templates/admin' > directory in my project. I also set the > TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), >

Re: Where to store repetitive form logic?

2009-12-04 Thread Heigler
Maybe this code can help you about the approach, is just an example based on your previous templatetag (i haven't tested it): http://dpaste.com/129361/ The view isn't really generic, but i probablly would follow that approach to solve this problem. -- You received this message because you are

Fixtures don't retain primary keys from 'pk'

2009-12-04 Thread apramanik
Hi all, I've created a few yaml fixtures, but they don't retain the primary key you specify via "pk:". Here's a sample: - model: locations.location pk: 1 fields: type: 2 name: 'USA' aux_data: 'US' latitude: 12 longitude: -10 The primary key seems to always be 2 for every

Re: Where to store repetitive form logic?

2009-12-04 Thread jwpeddle
Not having any luck with this. Surely there's a simple example out there somewhere of view agnostic DRY form logic. On Dec 4, 10:43 am, jwpeddle wrote: > That is definitely one approach I hadn't considered, and just might > work in my situation. > > On Dec 4, 10:13 am,

Using admin search as keyword search?

2009-12-04 Thread Zeynel
I asked this in Stackoverflow but there was no answers: http://stackoverflow.com/questions/1849250/django-admin-search-functionality Can anyone here help with ways to achieve this: I have a simple database in django with SQLite and now I want to improve it with a better search capability (I will

How to get timeuntil tag to display minutes?

2009-12-04 Thread Continuation
I use the timeuntil tag in my template: (( object.end_time|timeuntil }} where end_time is a DateTimeField. What I got is output like "2 days, 23 hours" Is there any way to get timeuntil to display minutes as well? Thanks -- You received this message because you are subscribed to the Google

Re: django-registration terms of service link

2009-12-04 Thread Skylar Saveland
help_text is safe by default? Might be of some use. aa56280 wrote: > The "safe" filter works on a string, not the entire form. So you'll > have to apply it to the label of the field: > > {{ form.tos.label|safe }} > > Hope that helps. > > > > On Dec 4, 11:55 am, Viktor

Re: delete every record in a table?

2009-12-04 Thread Phlip
Doug Blank wrote: > > Plutocrat.objects.all().delete() > > I found that quite slow. If you want to stay DB agnostic, I came up with this: > >    from django.db import connection, transaction >    models = [Person, User, ...] >    cursor = connection.cursor() >    flush_tables = [] >    for model

Re: Importing users - salted sha1

2009-12-04 Thread Dave
THANK YOU!! (sorry, just a little excited). Yes, that worked perfectly. I edited my .get_hexdigest() by simply copying the sha1 encryption "if" statement, changed "sha1" to "ruby" (and did the same in my password field). Then I flipped salt and raw_password to match how it was done in my previous

Re: django-registration terms of service link

2009-12-04 Thread aa56280
The "safe" filter works on a string, not the entire form. So you'll have to apply it to the label of the field: {{ form.tos.label|safe }} Hope that helps. On Dec 4, 11:55 am, Viktor wrote: > ahoj, > > I wrote a simple backend that extends RegistrationFormTermsOfService

Re: delete every record in a table?

2009-12-04 Thread Nick Arnett
On Fri, Dec 4, 2009 at 12:56 PM, Christophe Pettus wrote: > > On Dec 4, 2009, at 12:37 PM, Phlip wrote: > > > could such a method > > call only send one SQL command? > > If you are using PostgreSQL as a back-end, it has a very efficient > command TRUNCATE for just such a

Re: delete every record in a table?

2009-12-04 Thread Doug Blank
On Fri, Dec 4, 2009 at 3:44 PM, Daniel Roseman wrote: > On Dec 4, 8:37 pm, Phlip wrote: >> Django users: >> >> I only ask the question to help improve my esthetics, but others might >> need a performance boost here. >> >> How to delete every record in

Re: delete every record in a table?

2009-12-04 Thread Christophe Pettus
On Dec 4, 2009, at 12:37 PM, Phlip wrote: > could such a method > call only send one SQL command? If you are using PostgreSQL as a back-end, it has a very efficient command TRUNCATE for just such a purpose, which you could sending as a raw SQL command:

Re: delete every record in a table?

2009-12-04 Thread Daniel Roseman
On Dec 4, 8:37 pm, Phlip wrote: > Django users: > > I only ask the question to help improve my esthetics, but others might > need a performance boost here. > > How to delete every record in a table? > > A related question - how to delete every record matching a filter, out >

delete every record in a table?

2009-12-04 Thread Phlip
Django users: I only ask the question to help improve my esthetics, but others might need a performance boost here. How to delete every record in a table? A related question - how to delete every record matching a filter, out of one internal SQL command? The brute-force way: for p in

Re: DRY up your Django templates with Showell Markup

2009-12-04 Thread David Martorana
I don't want to jump on something too quickly, being somewhat unproven, but it's a nice thing to have with GHRML being dead and HAML being Ruby only. I'll keep an eye on this! What plans do you have for future improvement? Dave On Nov 27, 1:08 pm, Steve Howell wrote: > I

Re: save_m2m() incorrectly ignoring exclude?

2009-12-04 Thread Margie Roginski
Ok, thanks Russell, I will do that. Just first wanted to confirm I wasn't missing something. Margie On Dec 3, 3:59 pm, Russell Keith-Magee wrote: > On Fri, Dec 4, 2009 at 6:23 AM, Margie Roginski > > > > wrote: > > In forms/models.py I see

Re: How to show output from external process

2009-12-04 Thread Shawn Milochik
On Dec 4, 2009, at 1:34 PM, Philippe Clérié wrote: > Are you using a library or did you code it yourself? What would be a good > library to start with? > > -- > > > Philippe > I use jQuery, and that makes it simple. First, have a view that returns JSON. Basically, this is all you need in

Re: How to show output from external process

2009-12-04 Thread Javier Guerra
2009/12/4 Philippe Clérié : > Are you using a library or did you code it yourself? What would be a good > library to start with? jQuery does it very handy: $("#elementID").load("http://your_url/for/the/data",{'var':value,'var2',value}); this simply does an HTTP query (with

Re: Sick of defining urls

2009-12-04 Thread bruno desthuilliers
On 4 déc, 18:46, Todd Blanchard wrote: > First, thanks for the critiques - I'm not surprised there are better ways to > write this as I'm just learning python. Thanks _you_ for taking the critiques as they were intented !-) > Second, url mapping for me is trivial.  Its a

Re: How to show output from external process

2009-12-04 Thread Philippe Clérié
Are you using a library or did you code it yourself? What would be a good library to start with? -- Philippe -- The trouble with common sense is that it is so uncommon. On Friday 04 December 2009 12:27:09 Shawn Milochik wrote: > On Dec 4, 2009, at 12:10 PM, Philippe Clérié wrote: > > I

Re: How to show output from external process

2009-12-04 Thread Philippe Clérié
The HTTP refresh has a time delay interval. The application is internal with less than 20 users at this time. And it's not as if this operation is going to be done by all of them at the same time. (Now that I think about it, perhaps I also need a way to block access while the database is being

Re: Audit trail code - avoid multiple foreign key issues?

2009-12-04 Thread Stodge
No progress so far. I know I can do this: attrs[field.name] = copy.copy(field) if attrs[field.name].rel: attrs[field.name].rel.related_name = "audit_%s_%s" % (cls.__name__, field.name) But this doesn't seem to make a difference. I still get: Error: One

django-registration terms of service link

2009-12-04 Thread Viktor
ahoj, I wrote a simple backend that extends RegistrationFormTermsOfService of django-restration as I would like to add links into the text stating that the user accepts the terms of service. But when I pass it to the template, the link's text is always escaped. I've tried to add a template

Re: Sick of defining urls

2009-12-04 Thread Todd Blanchard
First, thanks for the critiques - I'm not surprised there are better ways to write this as I'm just learning python. Second, url mapping for me is trivial. Its a web app, not a web site. I would be fairly happy with totally opaque urls ala seaside as long as I didn't have to think about

Re: How to show output from external process

2009-12-04 Thread Shawn Milochik
On Dec 4, 2009, at 12:10 PM, Philippe Clérié wrote: > I am working on an application that requires getting some data offsite, > process it and load the site database. This process can take up to five > minutes. I would like to be able to capture the output and present it to the > user so he

Re: How to show output from external process

2009-12-04 Thread Xia Kai
Hi! I think you can just log everything in that five minute process into a file. You can then write a view function that would read that file and display the latest progress of the process. On client side, you can use some javascript to visit the view function on a regular basis, say, every 10

How to show output from external process

2009-12-04 Thread Philippe Clérié
I am working on an application that requires getting some data offsite, process it and load the site database. This process can take up to five minutes. I would like to be able to capture the output and present it to the user so he knows how far along he is and whatever errors he needs to know

Re: Where to store repetitive form logic?

2009-12-04 Thread jwpeddle
That is definitely one approach I hadn't considered, and just might work in my situation. On Dec 4, 10:13 am, Heigler wrote: > I think the way is build your own generic view if you have customized > things like that comment tag. -- You received this message because you

Re: add permission by name instead of number

2009-12-04 Thread Adonis
Thanks lotz Tim! On Nov 27, 4:02 pm, Tim Valenta wrote: > You can expand your .add() statement slightly, by passing it an object > instead of an id: > > request.user.user_permissions.add(Permission.objects.get(name='somepermissionname')) > > You could alternatively do

Re: DateTimeField arithmetic problem

2009-12-04 Thread Bill Freeman
On Fri, Dec 4, 2009 at 4:48 AM, Max Battcher wrote: > Continuation wrote: >> if form.is_valid(): >>     object = form.save(commit=False) >>     delta = datetime.timedelta(days=object.days_difference) >>     object.end = object.start + delta >>     object.save() >> >> But I

Re: Where to store repetitive form logic?

2009-12-04 Thread Heigler
I think the way is build your own generic view if you have customized things like that comment tag. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this

Where to store repetitive form logic?

2009-12-04 Thread jwpeddle
I am currently trying to write a custom generic comment app and growing increasingly frustrated with template tags. As far as I can tell, template tags are the only mechanism provided that allow pieces of logic to be shared across templates. Nonetheless, you cannot treat them like a view, and

Audit trail code - avoid multiple foreign key issues?

2009-12-04 Thread Stodge
I'm playing around with the Audit code here: http://code.djangoproject.com/wiki/AuditTrail The Caveats section mentions: Likewise, it fails when there are multiple ForeignKeys? pointing to the same Model, as it doesn't support / compensate for related_name. Does anyone know if this

Field in admin not editable but still visible

2009-12-04 Thread grimmus
Hi, I have a hit_count integer field on my model with a default value of 0 In the admin area i would like to show this field (to see the amount of hits) but make it not editable. Is there any easy built in way to do this ? Thanks for any tips. -- You received this message because you are

permissions in templates

2009-12-04 Thread Adonis
Hi, I am trying to compare some existing permissions with the permissions that a project member has. From views.py i am giving a list with all available permissions. The problem is that the permission format is different and i cannot think of a slick way to compare them..My mind hovers around

Hello

2009-12-04 Thread Tsolmon Narantsogt
./manage.py syncdb then auto create a users permisions tell me. How to decide -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

MySQLdb (python 2.6/django from subversion)

2009-12-04 Thread Peter
Hi, I've installed django on an XP box and am trying to work through the tutorial. I got django from svn using the url from the django site: http://code.djangoproject.com/svn/django/trunk All is well until I try to do syncdb, at which point I get an error message: Error loading MySQLdb

Re: Test Application Without it's own models

2009-12-04 Thread Mark (Nosrednakram)
I thinks I may have figured out what seems to be a good way. I create the models in the top of the test.py file. This is working and the table are only there for testing so I'm no polluting my database with these tables after the tests are finished. Still looking for feedback on best practice

Test Application Without it's own models

2009-12-04 Thread Mark (Nosrednakram)
Hello Django Users, I have a few applications that don't have defined models but that interact with other models. The most recent is a full text search engine based on Whoosh. Whoosh has it own back end for storing indexes. The application indexes models but doesn't have any of it's own models

admin templates issue

2009-12-04 Thread gentlestone
I've tried to folow the tutorial and customize the admin template and made a copy of 'change_form.html' template into the 'templates/admin' directory in my project. I also set the TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'), After this, the result is

Re: Sick of defining urls

2009-12-04 Thread David De La Harpe Golden
Todd Blanchard wrote: > > I've solved my urls problem for now (though I'm open to more > elegant solutions) Depends what you're doing, but if what you're doing fits into its "chained views" convention, django-catalyst will also autogen relevant urls for you -

Re: render_to_response and HTTP status codes other than 200

2009-12-04 Thread chefsmart
Yeah it's a twisted idea, but I'm going to use it for informative 403 405 pages. On Dec 4, 3:51 pm, Daniel Roseman wrote: > On Dec 4, 8:37 am, chefsmart wrote: > > > According to the docs > >

Re: Calling Stored procedures from PostgresSQl

2009-12-04 Thread Daniel Hilton
2009/12/4 Geobase Isoscale : > Hi all, > Does anyone has an idea on how I can call a ' stored procedure' (function) > in posgresql into Django Form? > Many Thanks > Isoscale Do you mean in a Django way or do you mean into the Django Forms library? I think you mean in a

Calling Stored procedures from PostgresSQl

2009-12-04 Thread Geobase Isoscale
Hi all, Does anyone has an idea on how I can call a ' stored procedure' (function) in posgresql into Django Form? Many Thanks Isoscale -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Why does create_user work without importing User from django.contrib.auth.models

2009-12-04 Thread bruno desthuilliers
On 4 déc, 09:22, chefsmart wrote: > I guess it must be coming from > django.contrib.auth.middleware.AuthenticationMiddleware that I am > using. But I'm no Python / Django expert, so don't know for sure. > I really dont think so. Python's "global" namespace really means

Re: Why does create_user work without importing User from django.contrib.auth.models

2009-12-04 Thread bruno desthuilliers
On 3 déc, 16:56, chefsmart wrote: > I have checked, and am not importing User in my code. > Perhaps not directly, but if, for example, your models.py imports User AND your views.py does a "from models import *", then ALL names in the models.py module will be imported. --

newbie problem with ModelForm

2009-12-04 Thread Andreas Kuntzagk
Hi, have a (probably simple) problem using ModelForms. I'm following this guide: http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/ Here are my models: class Run(models.Model): name = models.CharField(max_length=200) class RunForm(ModelForm): class Meta: model =

Re: render_to_response and HTTP status codes other than 200

2009-12-04 Thread Daniel Roseman
On Dec 4, 8:37 am, chefsmart wrote: > According to the docs > athttp://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to... > the render_to_response shortcut "Renders a given template with a given > context dictionary and returns an HttpResponse object with

Re: Need help on jquery Ajax load(use load two times)

2009-12-04 Thread Daniel Roseman
On Dec 4, 9:52 am, NMarcu wrote: > Hello all, > >     I have a strange problem with jquery load. I have this two loads > on a click event: > > action='first'; > $( '#operators_list_div' ).html( '' ).load( '{% url > add_save_view %}',{'action':action, }); >

Re: Need help on jquery Ajax load(use load two times)

2009-12-04 Thread NMarcu
I put some alerts, before first load, before second load, and in every template. Them are fired like this: First the alert before first load Second the alert before second load(strange, I was expected to fire the alert from the first template) Third the alert form the second template Forth the

Need help on jquery Ajax load(use load two times)

2009-12-04 Thread NMarcu
Hello all, I have a strange problem with jquery load. I have this two loads on a click event: action='first'; $( '#operators_list_div' ).html( '' ).load( '{% url add_save_view %}',{'action':action, }); action='second'; $( '#address_list' ).html( '' ).load( '{% url add_save_view %}',

Re: DateTimeField arithmetic problem

2009-12-04 Thread Max Battcher
Continuation wrote: > if form.is_valid(): > object = form.save(commit=False) > delta = datetime.timedelta(days=object.days_difference) > object.end = object.start + delta > object.save() > > But I got the error: > type object 'datetime.datetime' has no attribute 'timedelta' This

Re: Show additional user information in admin

2009-12-04 Thread Kai Timmer
2009/12/3 Matt Schinckel : > I have an app called person which has my UserProfile in it: Now I got it. Thank you. Greetings, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- You received this message because you are

Re: Sick of defining urls

2009-12-04 Thread bruno desthuilliers
On 3 déc, 08:37, Todd Blanchard wrote: (snip) > A couple observations if you don't mind: > urlpatterns += patterns('', >     > (r'^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)\.(?P[^/]+)',dispatch_request), >     (r'^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)',dispatch_request), >    

Re: Fixtures and multi-table inheritance

2009-12-04 Thread Piotr Czachur
To be more specific I created sample application called "animal": ### mypro/animal/models.py from django.db import models class Animal(models.Model): name = models.CharField(max_length=30, primary_key=True) class Cat(Animal): tail_length = models.DecimalField(max_digits=4,

render_to_response and HTTP status codes other than 200

2009-12-04 Thread chefsmart
According to the docs at http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response the render_to_response shortcut "Renders a given template with a given context dictionary and returns an HttpResponse object with that rendered text." The HttpResponse object have a default

Re: Why does create_user work without importing User from django.contrib.auth.models

2009-12-04 Thread chefsmart
I guess it must be coming from django.contrib.auth.middleware.AuthenticationMiddleware that I am using. But I'm no Python / Django expert, so don't know for sure. On Dec 3, 8:56 pm, chefsmart wrote: > I have checked, and am not importing User in my code. > > I guess

Re: Problem with Image field saving

2009-12-04 Thread Phui Hock
You should retrieve file from request.FILES, not request.POST. On Dec 4, 2:57 pm, guptha wrote: > Hi group , > I am getting error like "Key 'fathers_photo' not found in > > forms.py > class FatherProfileForm(forms.Form): >     fathers_photo =