Re: admin add view saves two entries on submit

2009-07-22 Thread JP
Did some more testing now.. Some really weird behaviour in my admin add view. If I add an "Egg" object (see above) with an e value of "test1" it works (just adds once) but if I add with an e-value of "test 1" (extra space), two entries are added. Two requests are sent: [22/Jul/2009 11:13:44]

Re: Bug when creating Q object from string representation of another Q object?

2009-07-22 Thread Frédéric Hébert
You don't give us enough explanation about your error. What type of error have you got ? What is your orig variable ? How do you serialize your Q object ? Are you sure that a Q object can be instantiated like that ? Frédéric 2009/7/21 Margie : > > I have a

Re: admin add view saves two entries on submit

2009-07-22 Thread JP
Ok, this is probably just a browser issue/quirk with IE6. I tried the admin add view via Firefox 3.5 and it works as expected.. So my guess, the combination of IE6+devserver is the problem. Hopefully it wont happen when deployed on a real server :) /Ending monologue On 22 Juli, 11:19, JP

better uptime with a fallback app

2009-07-22 Thread Le Roux Bodenstein
I'm trying to keep my django powered cms online even when I have to restart the app or take it down for maintenance. My rendered pages are generally quite cacheable and they only change if someone content manages a page or someone comments, etc. which happens relatively rarely. I have a very

Re: How I run background processes

2009-07-22 Thread cheeming
I think the other situation is that the old cron job is not done yet and the new cron job gets started up. Having a flag in the DB would be able to fix that as well. On Jul 21, 9:33 pm, Andrew Fong wrote: > >> I was worried by potential caching issues with the database

Re: Recommendations for a Django development book?

2009-07-22 Thread Marco Buttu
On Tue, 2009-07-21 at 09:36 -0700, Stodge wrote: > What is currently the best Django development book? My favorites are "The Definitive Guide to Django" (2nd edition), also called djangobook: http://www.djangobook.com/en/2.0/ and "Pratical Django Projects" (2nd edition):

Re: better uptime with a fallback app

2009-07-22 Thread Graham Dumpleton
On Jul 22, 8:19 pm, Le Roux Bodenstein wrote: > I'm trying to keep my django powered cms online even when I have to > restart the app or take it down for maintenance. > > My rendered pages are generally quite cacheable and they only change > if someone content manages a page

Re: better uptime with a fallback app

2009-07-22 Thread Le Roux Bodenstein
> If it is to bring down application for maintenance, seems like it > would be easier to use Apache/mod_wsgi in daemon mode. I'll give mod_wsgi a go. To be honest I never looked at it before simply because it is tied to apache. But if it can easily do everything I need using a reasonable amount

Re: better uptime with a fallback app

2009-07-22 Thread Graham Dumpleton
On Jul 22, 9:34 pm, Le Roux Bodenstein wrote: > > If it is to bring down application for maintenance, seems like it > > would be easier to use Apache/mod_wsgi in daemon mode. > > I'll give mod_wsgi a go. To be honest I never looked at it before > simply because it is tied to

Re: Customizing context by opening up BoundField, is it ok?

2009-07-22 Thread Russell Keith-Magee
On Wed, Jul 22, 2009 at 3:46 AM, Joshua Russo wrote: > > I have a complex form that where I generate a grid (for lack of a > better term) of fields for data entry. To simplify the template > context I have a dictionaries within dictionaries so I can just use > FOR loops

Hi people

2009-07-22 Thread sudharsan s
Hi i am new to django . i have interest towrds programing..so i need some help how to start with django i went through the official documentation of django and i also installed it.. after that i don know how to proceed --~--~-~--~~~---~--~~ You received this

Could not valid formset

2009-07-22 Thread prathameshp
I want display a list devices with a checkbox associated with each one and at submit collect all select the list items also each device is accompanied with device info from database I tried this with formset so that it is easy to valid but was unsuccessful I created a simple form with checkbox

Issue with saving manytomany items in custom form

2009-07-22 Thread gw
Hi all, I'm having an issue with saving manytomany items in a custom form. I've pasted an error description and extensive code excepts here: http://dpaste.com/69877/ . Basically, the form doesn't save the main instance properly, so the subsequent saving of manytomany items also fails (since the

Creating radio button search app

2009-07-22 Thread Divesh Gidwani
I have this site that I want to design on Django. I have already created the mysql side of it, and the mysql database is ready. Also, i have loaded mysqldb it works too. This is the site I have to re-design on Django: http://gomezlab.bme.unc.edu:8080/~kdauria/search.php so far i have this in

Re: Creating radio button search app

2009-07-22 Thread Divesh Gidwani
Also, what kind of views do I need? I'm really confused about that part. If somebody has snippets of their code that they may have written, it'll be great to see how its done. Thanks. Divesh --~--~-~--~~~---~--~~ You received this message because you are

Re: Hi people

2009-07-22 Thread Vasil Vangelovski
A good place to start is the tutorial: http://docs.djangoproject.com/en/dev/intro/tutorial01/ If you are new to python you can also check dive into python: http://diveintopython.org/ On Wed, Jul 22, 2009 at 10:52 AM, sudharsan s wrote: > > Hi i am new to django . i have

Re: Bug when creating Q object from string representation of another Q object?

2009-07-22 Thread Russell Keith-Magee
On Wed, Jul 22, 2009 at 5:52 AM, Margie wrote: > > I have a situation where I want to do the following: >       take a bunch of POST params and from them create a Q object >       urlencode that Q object and turn it into a GET param, redirect > using that param >      

Use an arbitrary changelist

2009-07-22 Thread TiNo
Hi, I would like a second changelist for an app. Besides the changelist that shows all members, I would like to show a changlist that show all members interested in some category. I now I can apply a list filter in the main list, but I rather have a separate list where the admin returns to after

Re: better uptime with a fallback app

2009-07-22 Thread Le Roux Bodenstein
>  http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usa... Wow. Thanks. I'm reading your entire blog now - it is really helpful. I just realised how little I know about this. Your blog is certainly the best resource on this topic I've ever seen. Since I'm currently running

Re: middleware cache problem

2009-07-22 Thread Alex Robbins
It sounds like the problem is that you are caching the whole page using the site wide cache. Maybe things would work better if you used the low level cache api.[1] from django.core.cache import cache MY_STORY_CACHE_KEY = "story_list" def story_list(request): story_list =

Re: better uptime with a fallback app

2009-07-22 Thread Graham Dumpleton
On Jul 22, 10:17 pm, Le Roux Bodenstein wrote: > >  http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usa... > > Wow. Thanks. I'm reading your entire blog now - it is really helpful. > I just realised how little I know about this. Your blog is certainly > the

django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Léon Dignòn
Hey folks, I don't know how to implement the RegistrationFormUniqueEmail subclass. I have a new project and installed django-registration. I got some templates wich work well. Now I want, that E-Mail addresses are unique. For that in the forms-documentation is mentioned, that there is a

Re: Model inheritance problem, inherited instances

2009-07-22 Thread Peter Cicman
Hi Rodrigue, thats exactly what i tried as a first, but unfortunately something like this doesn't work. And seems there isn't any "standard" workaround for this. Solutions are: 1.) call raw sql for creating record in B table, 2.) copy all local_fields values from a to b, after this save works..

Re: better uptime with a fallback app

2009-07-22 Thread Le Roux Bodenstein
> The only criticism I have seen of lighttpd is that is has been a long > time since last release and that it can leak memory. Don't know how > valid that is, so I could be generating my own FUD here. :-) Well. I was running it for more than a year without a restart at some stage and I didn't

Re: What editor do you use for .po files?

2009-07-22 Thread Joshua Russo
That looks really slick. Thanks for the link. On Tue, Jul 21, 2009 at 8:44 PM, Jonas Obrist wrote: > > Haven't started by i18n yet but rosetta looks good: > http://code.google.com/p/django-rosetta/ > > bittin wrote: > > i also use PoEdit =) > > > > On Fri, Jun 19, 2009 at

Re: better uptime with a fallback app

2009-07-22 Thread Tom Evans
On Wed, 2009-07-22 at 04:47 -0700, Graham Dumpleton wrote: > > > On Jul 22, 9:34 pm, Le Roux Bodenstein wrote: > > > If it is to bring down application for maintenance, seems like it > > > would be easier to use Apache/mod_wsgi in daemon mode. > > > > I'll give mod_wsgi a

Re: Django way to design this model

2009-07-22 Thread Divesh Gidwani
Point 4 above is a little ambiguous: >4. Move the queries you've created to a view that renders results to >a template. If you start doing this by accepting GET parameters and >displaying the search results through the template, you can get the >query functionality working and test it by

Re: Bug when creating Q object from string representation of another Q object?

2009-07-22 Thread Margie
Yes - sorry about the typo. As you say, the "orig" should be filter_orig - that was a cut and paste mistake. I was playing around and I think I just mistakenly assumed that I could create a Q from the string representation of another Q. Sounds like that was a mistaken assumption. What I have

Re: django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Ronghui Yu
You don't need to implement one, it is there in registration/forms.py What you need to do is configure you url like this url(r'^register/$', register, {'form_class':RegistrationFormUniqueEmail},

Enforcing requirements for user passwords on admin site

2009-07-22 Thread Topa
I'd like to require that user passwords be of a certain level of complexity when they're added to or changed on the admin site. I see a way to do this fairly easily with the password reset view since I can pass in a custom form, but I don't see an easy way to do it when adding a user or using the

Re: django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Léon Dignòn
How did you know about the parameter in brackets{}, what part of the documentation have I to read to know that? And how do you know I have to use 'form_class'? On Jul 22, 4:59 pm, Ronghui Yu wrote: > You don't need to implement one, it is there in registration/forms.py >

Re: Use an arbitrary changelist

2009-07-22 Thread Alex Gaynor
On Wed, Jul 22, 2009 at 7:08 AM, TiNo wrote: > Hi, > I would like a second changelist for an app. Besides the changelist that > shows all members, I would like to show a changlist that show all members > interested in some category. I now I can apply a list filter in the main >

Pass template tags through TextField?

2009-07-22 Thread Ogre
I have a model where I need to be able to insert template tags into a TextField in the admin as part of the content and then have them rendered properly on the front-end. Can this be done? And if so, can someone recommend a method? I understand the security concerns of opening that field up to

Re: Pass template tags through TextField?

2009-07-22 Thread Dan Harris
That shouldn't be a problem, after all templates are just strings as are textfields. If you have a model with your textfield in it as so: class MyModel(models.Model): template = models.TextField() and you have a view which renders the template defined in the next field def

Re: Pass template tags through TextField?

2009-07-22 Thread Ogre
Perfect. Thanks, Dan. On Jul 22, 10:23 am, Dan Harris wrote: > That shouldn't be a problem, after all templates are just strings as > are textfields. > > If you have a model with your textfield in it as so: > > class MyModel(models.Model): >    template = models.TextField()

Re: django-registration and RegistrationFormUniqueEmail subclass

2009-07-22 Thread Dan Harris
The stuff in the brackets are the optional arguments passed to the "register" view. You can read the documentation about the view at: http://bitbucket.org/ubernostrum/django-registration/src/b360801eae96/docs/views.txt Alternatively you can check out the code as well. Cheers, Dan

Re: Use an arbitrary changelist

2009-07-22 Thread Some Guy
You want this... http://blog.dougalmatthews.com/2008/10/filter-the-django-modeladmin-set/ Be aware though, of a bug* in manage.py that, if you dumpdata with only your app specified, you will get entries for the proxy model as well. The proxy model entries will screw up your next loaddata, so I

Re: OSX - says view is missing but it isn't

2009-07-22 Thread phoebebright
Finally found the problem was a recusive call when I happened to be using the shell. Strange that it would work at all! In [1]: import tweetlog.views --- ImportError Traceback (most recent

OneToOneFields: How do you use them?

2009-07-22 Thread Dudley Fox
I have a simple test model defined: class Friend(models.Model): name = models.CharField(max_length=120) class Person(models.Model): name = models.CharField(max_length=120) friend = models.OneToOneField(Friend) Here is a sample of usage, and obviously I am doing something wrong... >>>

Re: OneToOneFields: How do you use them?

2009-07-22 Thread Some Guy
Just a guess, but maybe... >>> p = mymodels.Person() >>> p.name="John Smith" >>> f = mymodels.Friend() >>> f.name = "John Q. Smith" add this here so it gets an id?? f.save() >>> p.friend = f >>> p.save() On Jul 22, 12:15 pm, Dudley Fox wrote: > I have a simple test

Re: Customizing context by opening up BoundField, is it ok?

2009-07-22 Thread Joshua Russo
On Wed, Jul 22, 2009 at 10:51 AM, Russell Keith-Magee < freakboy3...@gmail.com> wrote: > > Secondly, it's difficult to give an appraisal of a technique when all > you have to go by is a vague description. Your explanation is a bit > hard to follow - you talk at length about fields, but don't

Using Model Object Data in views.py

2009-07-22 Thread rpupkin77
Hi, this is probably a really basic question, but i can't find the answer anywhere. I need to get data from a model and use it in the view (views.py), before I pass it to the template. However, the result I get back (when i examine the local vars) has only the value returned by the __unicode

Re: Using Model Object Data in views.py

2009-07-22 Thread Javier Guerra
On Wed, Jul 22, 2009 at 7:54 PM, rpupkin77 wrote: > However, the result I get back (when > i examine the local vars) has only the value returned by the __unicode > function, in this instance, the "title" column this happens when you coerce (or 'cast') the model object

Re: Using Model Object Data in views.py

2009-07-22 Thread Daniel Roseman
On Jul 22, 8:54 pm, rpupkin77 wrote: > Hi, > > this is probably a  really basic question, but i can't find the answer > anywhere. > > I need to get data from a model and use it in the view (views.py), > before I pass it to the template. However, the result I get back

Re: Using Model Object Data in views.py

2009-07-22 Thread rpupkin77
Yes, I actually had an error elsewhere apologies. I understand objects fine, BTW but am new to Django (beyond the tutorials). It was odd to me that the error was happening it seemed like i should have had access to the data.All set now. On Jul 22, 4:01 pm, Daniel Roseman

Re: OneToOneFields: How do you use them?

2009-07-22 Thread Dudley Fox
That worked! Thanks, Dudley On Wed, Jul 22, 2009 at 2:49 PM, Some Guy wrote: > > Just a guess, but maybe... > p = mymodels.Person() p.name="John Smith" f = mymodels.Friend() f.name = "John Q. Smith" > > add this here so it gets an id?? > f.save() >

Cascade Soft Delete

2009-07-22 Thread Steven Stelmach
Hi all, I'm working with models (for a newspaper site) similar to this: - Abstract class Content with child class Article. - Each Content object is related one-to-one with a ContentGeneric, which has a published_status field. - Articles have related_content, which is a M2M field with

Ajax-based generic views?

2009-07-22 Thread djangonoob
Hi all, i understand that this is a recurring topic. But i couldnt find any ajax-based generic views tutorials/threads, etc. How do we implement ajax-based generic views? BEst Rgds. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: URL Patterns for URL Encoding Symbols

2009-07-22 Thread emil0r
> I wish I could specify all the unicode letters (for all other > languages apart from Turkish) as something like \w. Best thing I've come up with is to go over the unicode list and identify which languages you want to support. You then use unichr to construct a regex such as: '[%s-%s]' %

Re: customizing admin template - how to refer to specific field

2009-07-22 Thread sico
This has been put in the "too hard" basket for now. I'm upgrading from django 0.96 to 1.0.2 and was hoping to make this custom view a configured admin view but am leaving that till later now as it's taking too much time away from porting the rest of the system. On Jul 21, 11:43 am, sico

Re: Hi people

2009-07-22 Thread Amit Sethi
Take up a small project like the tutorial... On Wed, Jul 22, 2009 at 1:00 PM, Vasil Vangelovski wrote: > > A good place to start is the tutorial: > > http://docs.djangoproject.com/en/dev/intro/tutorial01/ > > If you are new to python you can also check dive into python: >

Java and Python

2009-07-22 Thread slypete
Hi everyone, I'm looking for opinions on how to get Java and Python bidirectionally communicating . For example, I have a server written in Java that I'd like to have use my django model classes to insert database data and trigger events. In the other case, I'd like to call some java libraries I

Re: Ajax-based generic views?

2009-07-22 Thread mhulse
> How do we implement ajax-based generic views? I am also a noob, but I personally would google: django and jquery Seems like Django is one beast to tackle, and Jquery is another. Cheers, M --~--~-~--~~~---~--~~ You received this message because you are

Re: Ajax-based generic views?

2009-07-22 Thread Vasil Vangelovski
What exactly do you mean by "ajax-based generic views"? Most often you'd return a JSON response to an xhr request so instead of passing a dict as a context object to render_to_response you'd return an HTTP response with the dict serialized as JSON. Follow any guidelines for making views generic,

Re: Creating radio button search app

2009-07-22 Thread Joshua Russo
On Wed, Jul 22, 2009 at 10:39 PM, Joshua Russo wrote: > On Wed, Jul 22, 2009 at 10:58 AM, Divesh Gidwani wrote: > >> >> Also, what kind of views do I need? I'm really confused about that >> part. > > > If you want to mimic the current application you

Re: Java and Python

2009-07-22 Thread Vasil Vangelovski
You can certainly run django 1.0.2 in apache tomcat, jetty etc. See these: http://docs.djangoproject.com/en/dev/howto/jython/ http://code.google.com/p/django-jython/ It's a bit slower though (will fool anyone that it's a Java web app). On Wed, Jul 22, 2009 at 11:58 PM,

Sqlite3 ok from deployment?

2009-07-22 Thread Some Guy
Having finished a small app, i'm wondering if it's ok to use sqlite3 in a deployment with mod_python and apache. I've read that sqlite is not meant for multi-user access where the actual db file is shared, but with several mod_pythons running will it be an issue if they are all having access to

Re: Sqlite3 ok from deployment?

2009-07-22 Thread Vasil Vangelovski
I don't think it really matters if one or more processes/threads try to access it, when it get's locked EXCLUSIVE for writing only one will have access to it until the lock gets released. For a very low volume site with very few INSERT/UPDATE/DELETE queries you may not experience any difference

Re: Sqlite3 ok from deployment?

2009-07-22 Thread Some Guy
Thanks, it's an in-house thing so I don't anticipate growth. I guess i'll stick with sqlite for now. Your reassurance is appreciated! On Jul 22, 5:24 pm, Vasil Vangelovski wrote: > I don't think it really matters if one or more processes/threads try > to access it, when

Re: Cascade Soft Delete

2009-07-22 Thread Russell Keith-Magee
On Thu, Jul 23, 2009 at 2:57 AM, Steven Stelmach wrote: > > Hi all, > > I'm working with models (for a newspaper site) similar to this: > > - Abstract class Content with child class Article. > - Each Content object is related one-to-one with a ContentGeneric, > which has a

Re: Cascade Soft Delete

2009-07-22 Thread Russell Keith-Magee
On Thu, Jul 23, 2009 at 2:57 AM, Steven Stelmach wrote: > > Hi all, > > I'm working with models (for a newspaper site) similar to this: > > - Abstract class Content with child class Article. > - Each Content object is related one-to-one with a ContentGeneric, > which has a

Re: Customizing context by opening up BoundField, is it ok?

2009-07-22 Thread Russell Keith-Magee
On Thu, Jul 23, 2009 at 3:51 AM, Joshua Russo wrote: > On Wed, Jul 22, 2009 at 10:51 AM, Russell Keith-Magee > wrote: >> >> Secondly, it's difficult to give an appraisal of a technique when all >> you have to go by is a vague description. Your

Customizing a manytomany admin box

2009-07-22 Thread knicholes
Hey, I used the admin to display a manytomany field (that had over 60,000 entries) and used raw_id_field = ('hugeDatabaseField'). This took care of the problem, but I wanted to be able to sort my manytomany field, so I added an intermediary class to handle the sort order. Once I added the

Django-admin {{ root_path }} problem !

2009-07-22 Thread Hamza
Hello , i have an issue in Django-Admin , when i click on logout and change password , it add /admin/logout and /admin/change_password/ to the current path as in http://localhost:8000/admin/posts/admin/logout/ and does the same to password_change . when trying to manually override this by

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Russell Keith-Magee
On Thu, Jul 23, 2009 at 12:57 PM, Hamza wrote: > > Hello , > > i have an issue in Django-Admin , when i click on logout and change > password , it add /admin/logout and /admin/change_password/ to the > current path as in http://localhost:8000/admin/posts/admin/logout/ and

Re: Ajax-based generic views?

2009-07-22 Thread djangonoob
The following is replied by Vasil: *** Very much depends on your application and how far down that rabbit hole you want to go. Basically a good practice for a standard web app would be not to have so much ajax to the

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Dr.Hamza Mousa
Hello Thanks Russ for the fast reply , The url for the admin is the same as the default : (r'^admin/', include(admin.site.urls)), about trying to fix the issue and override this by adding the absolute url in " base.html " admin template temporary till i figure out what is causing this . I am

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Alex Gaynor
Did you by any chance copy the text of the old templates, from before the rc? If so you'll need to update them for thr changes. Alex On Jul 23, 2009 12:35 AM, "Dr.Hamza Mousa" wrote: Hello Thanks Russ for the fast reply , The url for the admin is the same as the

Re: Model save() weird behaviour

2009-07-22 Thread Phil
Thanks Brian, 'QWERTY' goes from the form entry here...but that's not important as issue is located somewhere else, precisely save is called twice... apologise for that Cheers, Philip On Jul 21, 2:52 pm, Brian May wrote: > On Thu, Jul 16, 2009 at 04:09:36AM

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Dr.Hamza Mousa
do you mean admin templates ?! i think its the template file of the RC ! Thanks Hamza On Thu, Jul 23, 2009 at 8:37 AM, Alex Gaynor wrote: > Did you by any chance copy the text of the old templates, from before the > rc? If so you'll need to update them for thr

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Russell Keith-Magee
On Thu, Jul 23, 2009 at 1:42 PM, Dr.Hamza Mousa wrote: > do you mean admin templates ?! i think its the template file of the RC ! Saying "I think" isn't quite the help we're looking for - are you using the default admin templates, or not? Have you taken _any_ copies of

Django 1.0.2 ordering fireign keys

2009-07-22 Thread adelaide_mike
Hi Lets say I have two models Street and House, related by a foreign key thus: class House(models.Model): house_number = models.CharField(max_length=16) street = models.ForeignKey(Street) In the admin area, the Change House page displays a list widget by which to select the street. I

Re: building directory path with user table

2009-07-22 Thread neridaj
I'm new to django and not sure how to do this, is this remotely close? class Listing(models.Model): user = models.ForeignKey(User, unique=True) zipfile = models.FileField(upload_to='listings') name = models.CharField(max_length=50) order = models.ForeignKey('Order') def