Re: Users getting logged out frequently

2012-01-06 Thread Kevin
Which backend is storing the session data? If session data is being stored in the cache(which is normally the recommended way), what caching backend are you using? If you are using locmem cache backend, this might be your problem, change the cache backend to something more stable for production.

Re: Limiting choices for ModelForm's ForeignKey/ManyToMany

2012-01-06 Thread Kevin
Thanks, this was exactly what I was looking for, here's the code I used: form.fields["rate"].queryset = Rate.objects.filter(company_id=the_company.id) Although with my own fields, and it worked perfectly. Something else that other users may use more than this type would be something like this:

Re: molecular formulae

2012-01-06 Thread Russell Keith-Magee
On Fri, Jan 6, 2012 at 1:43 PM, Mike Dewhirst wrote: > I think I have found a workaround but it will probably blow up in my face > due to encoding/decoding things I don't fully understand. > > Can anyone comment on the robustness of calling the following method in a > model's save() ... Well... i

Re: Passing variables from a context processor to a template

2012-01-06 Thread Guy Nesher
Thanks, Works perfectly now (and yeah I'm fairly new to Python/Django) On Jan 5, 5:44 pm, Rainy wrote: > On Jan 5, 12:38 pm, Rainy wrote: > > > > > > > > > > > On Jan 5, 12:35 pm, Guy Nesher wrote: > > > > Thanks, > > > > I've initially tried to use a dictionary but was still unable to pull >

Re: molecular formulae

2012-01-06 Thread Mike Dewhirst
On 06/01/2012, at 8:03 PM, Russell Keith-Magee wrote: > On Fri, Jan 6, 2012 at 1:43 PM, Mike Dewhirst wrote: >> I think I have found a workaround but it will probably blow up in my face >> due to encoding/decoding things I don't fully understand. >> >> Can anyone comment on the robustness of

Re: molecular formulae

2012-01-06 Thread aastrand
Unfortunately, an automatic capitalization routine would not work in general. Take Co (the element cobolt) and CO (the molecule carbonmonoxide) as an example. Nickel, Ni, would be another case; NI3 (nitrogen triiodide) is an explosive wheras Ni3 would be a small Ni cluster. Capitalization has a mea

Re: Users getting logged out frequently

2012-01-06 Thread Arun P
@Kevin: The backend used is the default Database backend. There are no other projects which share the same domain space. I guess will have to write a middleware to see what is happening to the cookies. Thanks. On Fri, Jan 6, 2012 at 2:26 PM, Kevin wrote: > Which backend is storing the session

Re: Taking a sample mysql dump

2012-01-06 Thread Arun P
You may have to look at mysqldump manual http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html On Fri, Jan 6, 2012 at 12:03 AM, Amit Sethi wrote: > Is there a way one could take the dump of just a few sample fields using > mysqldump or some other similar tool. ?? Such that you can use it similar

Re: Users getting logged out frequently

2012-01-06 Thread Jacco Flenter
What kind of software stack are you running? Apache and... or nginx and...? On Fri, Jan 6, 2012 at 10:51 AM, Arun P wrote: > @Kevin: > > The backend used is the default Database backend. > There are no other projects which share the same domain space. > > I guess will have to write a middleware

Re: Users getting logged out frequently

2012-01-06 Thread Arun P
Hi Jacco The stack is nginx -> apache with wsgi. nginx caching is turned for some url patterns. Thanks On Fri, Jan 6, 2012 at 3:50 PM, Jacco Flenter wrote: > What kind of software stack are you running? Apache and... or nginx and...? > > > On Fri, Jan 6, 2012 at 10:51 AM, Arun P wrote: > >> @

Re: This Week In History

2012-01-06 Thread Tim Sawyer
That's cunning - hadn't thought of doing it that way, though I'm using postgres 8.4. This has something similar: http://www.postgresql.org/docs/7.4/static/functions-formatting.html Cheers, Tim. On 05/01/12 23:09, Thorsten Sanders wrote: You dont mention the database you use if mysql you cou

Model for images with thumbnails

2012-01-06 Thread MeME
Hello, I'm new to Django. I started to write something for personal purposes. I have doubts about writing model for media files, especially images. In my app thumbnails should be automatically created when image is uploaded. Each such image can have thumnails with different dimensions. Images can

Re: project root or its parent in pythonpath?

2012-01-06 Thread Waldek Herka
Hi, how about creating a proper package and installing it as an egg? That would be a proper way I think. See this tutorial: http://peak.telecommunity.com/DevCenter/setuptools It is only a matter of creating the setup.py with the list of the stuff you need to package, then you run(from the projec

Re: molecular formulae

2012-01-06 Thread Mike Dewhirst
I agree. I was wrong to try anything with the non-numerics. They need to be left as the user entered them. Thanks Mike On 06/01/2012, at 8:46 PM, aastrand wrote: > Unfortunately, an automatic capitalization routine would not work in > general. Take Co (the element cobolt) and CO (the molecul

Re: molecular formulae

2012-01-06 Thread aastrand
Also note that you have a math tag in html. Something like Fe_2_^2+^Cr_2_O_4_ might do the job for you. Per-Olof On Jan 6, 1:41 pm, Mike Dewhirst wrote: > I agree. I was wrong to try anything with the non-numerics. They need to be > left as the user entered them. > > Thanks > > Mike > > On 0

{% url 'admin:jsi18n' as jsi18nurl %} error as urls.py

2012-01-06 Thread MikeKJ
This is probably an oldie and I remember coming across it before but damned if I remember the solution: upgrading an old django site Request Method: GET Request URL: http://nortonsdairy.paston2.webfactional.com/admin/products/item/ Django Version: 1.3.1 Exc

Re: Model for images with thumbnails

2012-01-06 Thread francescortiz
you can try https://github.com/francescortiz/image On 6 ene, 12:35, MeME wrote: > Hello, > > I'm new to Django. I started to write something for personal > purposes. > I have doubts about writing model for media files, especially images. > In my app thumbnails should be automatically created when

Having trouble passing a parent table record “id” to a new record in a child table

2012-01-06 Thread BillB1951
I am having trouble passing a parent table record “id” to a new record in a child table. My urlconf calls add_childtable in my views.py and passes the parenttable_id to it. I have excluded the parenttable from my ChildTableForm(ModelForm) because I do not want it to be available to the users. Wh

Re: Model for images with thumbnails

2012-01-06 Thread Иван Иванов
На Fri, 6 Jan 2012 07:08:59 -0800 (PST) francescortiz написа: > you can try https://github.com/francescortiz/image or you can try https://github.com/SmileyChris/easy-thumbnails > On 6 ene, 12:35, MeME wrote: > > Hello, > > > > I'm new to Django. I started to write something for personal > > pu

Re: Model for images with thumbnails

2012-01-06 Thread Andres Reyes
I've found that the most flexible approach is the one taken by http://thumbnail.sorl.net/ 2012/1/6 Иван Иванов : > На Fri, 6 Jan 2012 07:08:59 -0800 (PST) > francescortiz написа: > >> you can try https://github.com/francescortiz/image > > or you can try https://github.com/SmileyChris/easy-thumbna

dumpdata and self referencing foreign keys

2012-01-06 Thread Michael Elkins
I have a model which represents a tree structure using a foreign key to itself: class Foo(models.Model): name = models.CharField(max_length=30) parent = models.ForeignKey('Foo') My problem is that "django-admin dumpdata" does not sort the rows such that it avoids forward refere

Re: Having trouble passing a parent table record “id” to a new record in a child table

2012-01-06 Thread Andre Terra
I introduce to you django-mptt: "utilities for implementing a modified pre-order traversal tree in django". https://github.com/django-mptt/django-mptt http://django-mptt.github.com/django-mptt/ Cheers, AT On Fri, Jan 6, 2012 at 1:12 PM, BillB1951 wrote: > I am having trouble passing a parent

Avoid m2m relations to be saved

2012-01-06 Thread Mario8k
Hi, I need to prevent to save a model overriding the ModelAdmin save_model() method. When i try to avoid obj.save(), direct fields are not saved, but related m2m fields are saved as well. def save_model(self, request, obj, form, change): if request.user.is_superuser: obj.save(

Re: Having trouble passing a parent table record “id” to a new record in a child table

2012-01-06 Thread Daniel Roseman
On Friday, 6 January 2012 15:12:29 UTC, BillB1951 wrote: > > I am having trouble passing a parent table record “id” to a new record > in a child table. My urlconf calls add_childtable in my views.py and > passes the parenttable_id to it. I have excluded the parenttable from > my ChildTableFo

memcached, django 1.3: per-site caching with middleware

2012-01-06 Thread trewq
Hi Folks, I am trying to get memcached working with django, and based on stats from the memcached, it is getting requests, but django is not sending it any thing. I created a question on stackoverflowand looks like a de

Re: Model for images with thumbnails

2012-01-06 Thread BillB1951
You may want to check out a tutorial on lightbird.net link is: http://www.lightbird.net/dbe/photo.html Bill On Jan 6, 6:35 am, MeME wrote: > Hello, > > I'm new to Django. I started to write something for personal > purposes. > I have doubts about writing model for media files, especially ima

Re: molecular formulae

2012-01-06 Thread Mike Dewhirst
On 6/01/2012 8:03pm, Russell Keith-Magee wrote: On Fri, Jan 6, 2012 at 1:43 PM, Mike Dewhirst wrote: I think I have found a workaround but it will probably blow up in my face due to encoding/decoding things I don't fully understand. Can anyone comment on the robustness of calling the following

Re: molecular formulae

2012-01-06 Thread Mike Dewhirst
On 7/01/2012 12:09am, aastrand wrote: Also note that you have a math tag in html. Something like Fe_2_^2+^Cr_2_O_4_ I'd like to make it look really nice but I don't have a CSS expert (nor a chemical engineer!) on the team yet. It is just me at the moment and I think unicode is my limit for

Re: dumpdata and self referencing foreign keys

2012-01-06 Thread Michael Elkins
On Fri, Jan 06, 2012 at 07:47:45AM -0800, Michael Elkins wrote: My problem is that "django-admin dumpdata" does not sort the rows such that it avoids forward references for the foriegn key values, which is a problem since I'm using MySQL InnoDB tables. I see that this problem seems to be fixed

Is the django coummity converging on a preferred REST API package?

2012-01-06 Thread JohnA
I’ve looked on this group, stackoverflow and the web at large for indication that the django community is converging on a single REST API package that is “preferred” and a potential candidate for inclusion in a future django distribution. So far all I’ve seen is people saying positive or negative

Re: Url rewrite for search engines

2012-01-06 Thread Lie Ryan
On 01/07/2012 11:04 AM, Barış Bilgiç wrote: Hi, I am looking for how to implement URL rewrite in Django which is explained inhttp://en.wikipedia.org/wiki/Rewrite_engine . For example,I would like to convert |http://127.0.0.1:8000/employer/details/20/| to|http://127.0.0.1:8000/employername-20.

Re: {% url 'admin:jsi18n' as jsi18nurl %} error as urls.py

2012-01-06 Thread Brett Epps
I don't see an obvious problem with your urls.py file. Have you tried checking that you're not mixing tabs and spaces in that file's whitespace? Brett On 1/6/12 8:48 AM, "MikeKJ" wrote: >This is probably an oldie and I remember coming across it before but >damned if I remember the solution: >

Re: Is the django coummity converging on a preferred REST API package?

2012-01-06 Thread Brett Epps
I used Tastypie for a project recently and was pretty happy with it. I think Piston was the preferred package before Tastypie came about, but Piston hasn't seen as much development recently. Then again, Piston seems to be good enough for Bitbucket, so it's probably good enough for many projects.

How many Django web pages does it take . . .

2012-01-06 Thread Bill Beal
Hi all, I've been doing Django and mostly backend Python for a few months, and I don't really know the limits of what can be done without resorting to JavaScript and Ajax. Here's what I need to do: the user wants to pick an individual from one of a number of lists and have the detailed information

Re: many-to-many queryset question

2012-01-06 Thread Peter of the Norse
One possibility is to try two excludes. bad_authors = Authors.objects.exclude(pk__in=SetOfAuthors) qs = Entry.objects.exclude(authors__in=bad_authors) This will return all entries that don't have authors in SetOfAuthors. It might even be easier, if you can skip creating SetOfAuthors in the first

Re: How many Django web pages does it take . . .

2012-01-06 Thread Alec Taylor
What you are talking about is a form. Form: https://docs.djangoproject.com/en/dev/topics/forms/ Autocomplete: https://code.djangoproject.com/wiki/AutoCompleteSolutions Unique fields: https://docs.djangoproject.com/en/1.3/ref/forms/validation/ On Sat, Jan 7, 2012 at 11:56 AM, Bill Beal wrote: > H