Creating test databases in parallel

2020-04-01 Thread cool-RR
Hi guys,

I'm trying to optimize our Django testing workflow.

We have 7 different databases, and Django spends a lot of time on these 
lines: 


Creating test database for alias 'main_database'...
Creating test database for alias 'foo_database'...
Creating test database for alias 'bar_database'...
Creating test database for alias 'baz_database'...


This is especially annoying when you're running just one test, but have to 
wait 1:30 minutes just for these test databases.

*Is there any way to speed this up? *Either by parallelizing it or in any 
other way. A few months ago I tried some naive code that parallelizes these 
actions, but it failed. (Unfortunately I don't have the error message 
saved.)


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com.


Prefetching a single item

2015-03-02 Thread cool-RR
Hi,

Say that I have a model Train and it has a ManyToMany to model Seat. I'm 
looking at a queryset of Train and I want to do a prefetch_related on it, 
but I don't want to get all the Seat objects; I want only the first Seat 
object for each Train object.  Is this possible with prefetch_related 
and/or Prefetch? How? 

To clarify: My goal here is to save on querysets while still being able to 
retrieve the first Seat object in each `train.seats`.


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d6fc84a-2042-40b5-98be-40bd971e706c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can the new `Prefetch` solve my problem?

2015-02-26 Thread cool-RR
James, you misunderstood me.

There isn't supposed to be a `favorite_or_nearby_chairs` attribute. That's 
the new attribute I want the prefetching to add to the `Desk` queryset that 
I need. Also, I don't understand why you'd tell me to add a `
.select_related('nearby_desks')` to my query. Are you talking about the 
query that starts with `Chair.objects`? I'm not looking to get a `Chair` 
queryset. I'm looking to get a `Desk` queryset, which has a prefetched 
attribute `favorite_or_nearby_chairs` which contains the `Chair` queryset I 
wrote down.


Thanks,
Ram.

On Thursday, February 26, 2015 at 6:02:15 AM UTC+2, James Schneider wrote:
>
> Well, the Desk model you provided is blank, but I'll believe you that 
> there's a favorite_or_nearby_chairs attribute. ;-)
>
> Should be relatively simple. Just add a .select_related('nearby_desks') to 
> your existing query and that should pull in the associated Desk object in a 
> single query. You can also substitute in prefetch_related(), although 
> you'll still have two queries at that point.
>
> If you are trying to profile your site, I would recommend the 
> Django-debug-toolbar. That should tell you whether or not that query set is 
> the culprit.
>
> -James
> On Feb 25, 2015 1:28 PM, "Ram Rachum" <r...@rachum.com > 
> wrote:
>
>> Hi James,
>>
>> I've read the docs but I still couldn't figure it out. My queryset works 
>> great in production, I'm trying to optimize it because our pageloads are 
>> too slow. I know how to use querysets in Django pretty well, I just don't 
>> know how to use `Prefetch`. 
>>
>> Can you give me the solution for the simplified example I gave? This 
>> might help me figure out what I'm not understanding. One thing that might 
>> be unclear with the example I gave, is that I meant I want to get a 
>> queryset for `Desk` where every desk has an attribute names 
>> `favorite_or_nearby_chairs` 
>> which contains the queryset of chairs that I desrcibed, prefetched.
>>
>>
>> Thanks,
>> Ram.
>>
>> On Wed, Feb 25, 2015 at 11:18 PM, James Schneider <jrschn...@gmail.com 
>> > wrote:
>>
>>> I assume that you are talking about the select_related() and 
>>> prefetch_related() queryset methods?
>>>
>>>
>>> https://docs.djangoproject.com/en/1.7/ref/models/querysets/#select-related
>>>
>>> https://docs.djangoproject.com/en/1.7/ref/models/querysets/#prefetch-related
>>>
>>> Both of those sections have excellent examples, and detail what the 
>>> differences are (primarily joins vs. separate queries, respectively).
>>>
>>> For better help, you'll need to go into more detail about the queries 
>>> you are trying to make, what you've tried (with code examples if possible), 
>>> and the results/errors you are seeing.
>>>
>>> In general, I would try to get an initial queryset working and gathering 
>>> the correct results first before looking at optimizations such as 
>>> select_related(). Any sort of pre-fetching will only confuse the situation 
>>> if the base queryset is incorrect.
>>>
>>> -James
>>>
>>> On Wed, Feb 25, 2015 at 12:05 PM, cool-RR <ram.r...@gmail.com 
>>> > wrote:
>>>
>>>> Hi guys,
>>>>
>>>> I'm trying to solve a problem using the new `Prefetch` but I can't 
>>>> figure out how to use it. 
>>>>
>>>> I have these models:
>>>>
>>>> class Desk(django.db.models.Model):
>>>> pass
>>>> 
>>>> class Chair(django.db.models.Model):
>>>> desk = django.db.models.Foreignkey('Desk', 
>>>> related_name='chair',)
>>>> nearby_desks = django.db.models.ManyToManyField(
>>>> 'Desk',
>>>> blank=True,
>>>> )
>>>>
>>>> I want to get a queryset for `Desk`, but it should also include a 
>>>> prefetched attribute `favorite_or_nearby_chairs`, whose value should be 
>>>> equal to: 
>>>>
>>>> Chair.objects.filter(
>>>> (django.db.models.Q(nearby_desks=desk) | 
>>>> django.db.models.Q(desk=desk)),
>>>> some_other_lookup=whatever,
>>>> )
>>>>
>>>> Is this possible with `Prefetch`? I couldn't figure out how to use the 
>>>> arguments.
>>>>
>>>>
>>>> Thanks,
>>>> Ram.
>>>>
>>>> -- 
>>>> You received this message becau

Can the new `Prefetch` solve my problem?

2015-02-25 Thread cool-RR
Hi guys,

I'm trying to solve a problem using the new `Prefetch` but I can't figure 
out how to use it. 

I have these models:

class Desk(django.db.models.Model):
pass

class Chair(django.db.models.Model):
desk = django.db.models.Foreignkey('Desk', related_name='chair',)
nearby_desks = django.db.models.ManyToManyField(
'Desk',
blank=True,
)

I want to get a queryset for `Desk`, but it should also include a 
prefetched attribute `favorite_or_nearby_chairs`, whose value should be 
equal to: 

Chair.objects.filter(
(django.db.models.Q(nearby_desks=desk) | 
django.db.models.Q(desk=desk)),
some_other_lookup=whatever,
)

Is this possible with `Prefetch`? I couldn't figure out how to use the 
arguments.


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/46d9fdb7-c008-4496-acda-ac7cb30b4a89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is there a good reason why Django querysets can't be intersected?

2014-03-16 Thread cool-RR
Hi everyone,

I understand that there's no way to get the intersection of two querysets 
in Django. Whenever I need to get the intersection of two querysets, I need 
to refactor my code to get pure Qs for those querysets and intersect those. 
This can be annoying sometimes.

My question: Is there a good reason why Django querysets can't be 
intersected? Do you think it should be implemented?


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b6b3a367-e5c0-4440-98b6-5a9d78a78db3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread cool-RR
Hi,

How do I control the admin ManyToManyField widget with the keyboard?


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6debf220-f450-4883-9021-502318880e0d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


List of default Django tags that are "mid-block" like else

2014-02-13 Thread cool-RR
Hi guys,

Can someone please give me a list of default Django template tags that have 
"mid-block" behavior like `else`? I mean tags where instead of simply 
having a start tag and an end tag, you have an optional tag in the middle 
that divides the whole thing to blocks.

I can think of: 

if
ifchanged
ifequal
else
elif

Anything else? 


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e69642f-f856-48db-8818-37697c85efd9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Djangocon videos

2013-10-21 Thread cool-RR
Hi guys,

I want to watch videos of talks from the recent Djangocon. But, I don't 
want to weed through all of them manually looking for the best ones. Did 
anyone make a "best of" list? Is there a way to sort by popularity or 
rating or something?


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/834b4f65-ce1f-40be-ada0-aac63f528d78%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Changing SECRET_KEY for a project that was already launched

2013-03-06 Thread cool-RR
Hi guys,

I have a project online whose SECRET_KEY was compromised. I obviously want 
to change it. Would anything bad happen if I change it? Would some things 
not work? Is it safe to just change it? Anything I should do?


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How do I change my user password on Django's bug tracker?

2011-07-26 Thread cool-RR
Hello,

How do I change my user password on Django's bug tracker?


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Z1HJTz2KIkEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Why is django-registration 0.8 not on PyPI?

2011-05-18 Thread cool-RR
Hey,

Does anyone know what's up with django-registration 0.8 not being on PyPI?


Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is `sys.path` supposed to be?

2010-09-17 Thread cool-RR
On Sep 17, 10:13 am, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> On 16 sep, 18:06, cool-RR <ram.rac...@gmail.com> wrote:
>
> > Hello!
>
> > There's something that's bothering me:
>
> > When developing a Django application, what is `sys.path` supposed to
> > contain? The directory which contains the project, or the directory of
> > the project, or both?
>
> sys.path always starts with the directory where the current script
> lives - so when running './manage.py runserver', sys.path will always
> starts with your project's directory. This is teh default Python
> behaviour. Also and IIRC, django adds the project's parent directory
> to sys.path too.
>
> > What led me to this question is a failure when using
> > `urlresolvers.reverse`. It's giving me a `NoReverseMatch` error, and
> > it seems that the reason is that there are two different versions of
> > my view function; One with a `__module__` of `my_app.views` and one
> > with a `__module__` of `my_project.my_app.views`.
>
> I bet you have a full import (=> 'myproject.my_app.views') somewhere
> in your sources.
>
> As far as I'm concerned, I *never* use any reference to the project's
> package in my imports - this gives much more flexibility (you can
> rename your project's directory, move apps outside the project's
> directory etc without having to update all your imports). The only
> caveat is that, when deploying with mod_wsgi, you have to make sure
> you add the project's directory itself to sys.path (which is no bige
> deal).

Bruno, look at this line in `django/core/management/__init__.py`:

project_module = import_module(project_name)

It's importing the project. Isn't this a problem? I mean, every object
obtained from the imported project will be different from its
counterpart which was imported through an app. So what's going on?


Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



What is `sys.path` supposed to be?

2010-09-16 Thread cool-RR
Hello!

There's something that's bothering me:

When developing a Django application, what is `sys.path` supposed to
contain? The directory which contains the project, or the directory of
the project, or both?

What led me to this question is a failure when using
`urlresolvers.reverse`. It's giving me a `NoReverseMatch` error, and
it seems that the reason is that there are two different versions of
my view function; One with a `__module__` of `my_app.views` and one
with a `__module__` of `my_project.my_app.views`. Because of Python
weirdness, these two different versions of the same function are not
considered identical to each other:

http://bugs.python.org/issue9872


Please help...


Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is the Django book written in ReST/Sphinx?

2010-06-01 Thread cool-RR
On Mon, May 17, 2010 at 2:00 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Mon, May 17, 2010 at 7:06 AM, cool-RR <ram.rac...@gmail.com> wrote:
> > I'm just working on a book for my own project, and I was wondering: Is
> > the Django book written in ReST/Sphinx? I am considering whether I
> > should write my book with that.
>
> This is slightly off topic for this list, but I would advise that this
> is something you need to take up with your publisher. Ultimately,
> whatever your personal preferences, your publisher will control the
> formats that you can use to submit a final manuscript.
>
> As for the specific question; I can't speak specifically for the
> Django Book, but I do know that Practical Django Projects was
> originally drafted in ReST, but had to be converted to Word format for
> final submission. Given that the Django Book published by the same
> publisher, I'm going to guess the same rules applied.
>
> Yours,
> Russ Magee %-)


Thanks for your help!

Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Is the Django book written in ReST/Sphinx?

2010-05-16 Thread cool-RR
I'm just working on a book for my own project, and I was wondering: Is
the Django book written in ReST/Sphinx? I am considering whether I
should write my book with that.

Thanks,
Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Making a "Common causes for translation problems"

2010-03-20 Thread cool-RR
Hey Russ,

At this point I'll just do a brief list, so I think I'll do it on the wiki.
I don't want to invest too much time into it, but I'll be happy if someone
else will want to expand it and put in in the documentation. (I think it'll
be really useful to people who use i18n.)

Thanks,
Ram.

On Sat, Mar 20, 2010 at 8:17 AM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

> On Fri, Mar 19, 2010 at 9:16 PM, cool-RR <ram.rac...@gmail.com> wrote:
> > Hello Django community,
> >
> > I have started compiling a list, "Common causes for translation
> > problems". Where would be a good place to put this list so people who
> > have a problem with their translations will be most likely to
> > encounter it?
>
> Depends on what exactly it is that you are writing.
>
> If you're just kicking around some ideas or trying to provide a page
> you can easily reference when someone on django-users asks a
> translation-related question, you could put your list up on Django's
> wiki (code.djangoproject.com). This isn't formal documentation, but
> many people put helpful snippets or discussions of common problems
> there.
>
> However, if you're writing something that might be useful to a general
> audience, feel free to suggest an addition to Django's own
> documentation. We have some existing guidelines for translators in our
> documentation, but if you think you can provide some additional
> guidelines or suggestions that would help others translate their
> Django projects, we'd love to see some draft text. Open a ticket on
> the documentation component, and provide a patch that adds your text.
>
> Yours,
> Russ Magee %-)
>
> --
> 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
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Sincerely,
Ram Rachum

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Making a "Common causes for translation problems"

2010-03-19 Thread cool-RR
Hello Django community,

I have started compiling a list, "Common causes for translation
problems". Where would be a good place to put this list so people who
have a problem with their translations will be most likely to
encounter it?

Ram Rachum.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Forcing HTTPS in admin

2010-03-01 Thread cool-RR
I did the middleware to do this, but I figured that making the admin
encrypted would be a common enough task that it should be a builtin
option in the admin. So anyway, +1 for that.

On Mar 1, 5:21 pm, Malcolm Box  wrote:
> You could, but doing it on the front-end webserver makes more sense.
>
> Malcolm
>
>
>
> On Mon, Mar 1, 2010 at 3:02 PM, ozgurv  wrote:
> > You can write a middleware that redirects users who visit admin
> > related pages (starts with /admin maybe) to HTTPS.
>
> > On Mon, Mar 1, 2010 at 2:08 AM, Janusz Harkot 
> > wrote:
> > > no, but you can do this very easy on the fronted-webserver (nginx,
> > > apache, cherokee etc.)
>
> > > J.
>
> > > --
> > > 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
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Özgür Vatansever
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Serving https with runserver

2010-03-01 Thread cool-RR
Adnan, I'm really baffled by your response. No, my reasons for using SSL
here is not because I'm afraid someone will sniff my data, We are talking
here about `runserver`, which is the development server which is never used
for production. The goal of `runserver` is to be able to easily test how
your Django project behaves before you upload it to the real server. So the
purpose of me wanting to use https on `runserver` are NOT because I think
someone will hack into my local machine. It's because I want to test the
behavior of the site. For example, I may have some complex redirection
scheme, where some http pages on the site redirect you to https, and vice
versa. So I would like to be able to test them out on the development
machine before uploading to the server.

I checked out Stunnel. I'd prefer to avoid it. It's another program I will
have to install and configure, and then I'll have to install and configure
an SSL library, and then these things will have to be connected with
`runserver`, which may result in problems and headache. The whole motivation
to use `runserver` is how easy and painless it is, so I'd prefer it include
these things out of the box.

Ram.

On Mon, Mar 1, 2010 at 2:53 AM, Adnan Sadzak  wrote:

> If it's on your local machine there is no big sense to use ssl unles you
> are paranoid. If someone can sniff local traffic, then ssl is useless.
> Anyway, as Janusz said http://www.stunnel.org/
>
>
> On Mon, Mar 1, 2010 at 1:06 AM, Janusz Harkot wrote:
>
>> So you can use stunnel: http://www.stunnel.org/
>>
>> J.
>>
>>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Serving https with runserver

2010-02-28 Thread cool-RR
I'm not using Apache on my development machine and I don't want to use
it. I enjoy the low headache factor of runserver. But it'll be nicer
if it served through https as well.

On Mar 1, 12:53 am, Andrej <amas...@gmail.com> wrote:
> because you need to load apache ssl gear. Set up your normal virtual
> host and then use reverse proxy:
>
>     ProxyPass /http://localhost:8000/
>     ProxyPassReverse /http://localhost:8000/
>
> On Feb 28, 5:09 pm, cool-RR <ram.rac...@gmail.com> wrote:
>
>
>
> > Why doesn't runserver automatically serve in https as well as http? It
> > would have been useful.
>
> > Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Serving https with runserver

2010-02-28 Thread cool-RR
Why doesn't runserver automatically serve in https as well as http? It
would have been useful.

Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Forcing HTTPS in admin

2010-02-28 Thread cool-RR
Does `admin` provide a way to force using it through https? I'd want
it to simply redirect a user which doesn't use https to the same
address, except with https instead of http.

Is there something like this built into `admin`?

Ram.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



A dark color scheme for the admin site

2010-02-14 Thread cool-RR
Hello,

Does anyone have a ready-made template with a dark color scheme for
the admin site? Ideally I'd want something where the text is light
grey and the background is dark grey, but I'd settle for anything
light-on-dark.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to set queryset on the second step of a form wizard?

2008-08-22 Thread rr

http://dpaste.com/73317/

I have dpasted it on the link above

Cheers
Roy

On Aug 21, 2:30 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Aug 21, 11:56 am, rr <[EMAIL PROTECTED]> wrote:
>
> > The url is herehttp://dpaste.com/72961/
>
> I don't see anything glaringly wrong. You mentioned that it "complains
> about 'ChannelTypeForm' object has no attribute 'cleaned_data'"...can
> you dpaste that error trace as well?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set queryset on the second step of a form wizard?

2008-08-21 Thread rr

The url is here
http://dpaste.com/72961/

-r

On Aug 21, 9:39 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Aug 21, 2:06 am, rr <[EMAIL PROTECTED]> wrote:
>
> > sorry for being annoying
>
> > It doesn't work, complains about
> > 'ChannelTypeForm' object has no attribute 'cleaned_data'
> > when submit on thesecondstep(step1)http://dpaste.com/72840/
>
> Can you also dpaste your URLs.py that shows whichformisstep0 andstep1?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set queryset on the second step of a form wizard?

2008-08-21 Thread rr

sorry for being annoying

It doesn't work, complains about
'ChannelTypeForm' object has no attribute 'cleaned_data'
when submit on the second step(step1)
http://dpaste.com/72840/

-r

On Aug 21, 1:51 am, rr <[EMAIL PROTECTED]> wrote:
> Don't worry.Formworks now. Thanks a lot.
>
> But would be great if you can explain it a bit on how your code works
> and the sequence of how process_steps and get_form works as I see it
> seems called a few time between steps
>
> Thanks =)
> -r
>
> On Aug 21, 1:42 am, rr <[EMAIL PROTECTED]> wrote:
>
> > It works well. Thanks a lot.
>
> > But now another problem. It seems "def done " is not working. It loops
> > back to the step1 and def done is never called
>
> > And do you mind explain how your code works? I did a "printstep"
> > before returnformin the def get_from, it prints 0, 1, 0. It seems it
> > has been called 3 times when submit in thesecondstep
>
> > What is the sequence of the call of process_step and get_form? the
> > docs didn't explain much about this
>
> > Thanks in Advance!!
> > -r
>
> > On Aug 20, 4:59 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 20, 12:57 pm, rr <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks Rajesh
>
> > > > But...it doesn't work
> > > > It complains about form0 doesn't have cleaned_data. I guess
>
> > > > form0 = super(MyFormWizard, self).get_form(0, data=data)
>
> > > > only gives you aformwith no data?!
>
> > > I just dpasted something that will help you capture the channelType
> > > fromstep0 and then use it when thestep1formis being created.
>
> > >http://dpaste.com/hold/72763/
>
> > > If that doesn't work, please dpaste your MyFormWizard code.
>
> > > -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set queryset on the second step of a form wizard?

2008-08-20 Thread rr

Don't worry. Form works now. Thanks a lot.

But would be great if you can explain it a bit on how your code works
and the sequence of how process_steps and get_form works as I see it
seems called a few time between steps

Thanks =)
-r

On Aug 21, 1:42 am, rr <[EMAIL PROTECTED]> wrote:
> It works well. Thanks a lot.
>
> But now another problem. It seems "def done " is not working. It loops
> back to the step1 and def done is never called
>
> And do you mind explain how your code works? I did a "printstep"
> before returnformin the def get_from, it prints 0, 1, 0. It seems it
> has been called 3 times when submit in thesecondstep
>
> What is the sequence of the call of process_step and get_form? the
> docs didn't explain much about this
>
> Thanks in Advance!!
> -r
>
> On Aug 20, 4:59 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > On Aug 20, 12:57 pm, rr <[EMAIL PROTECTED]> wrote:
>
> > > Thanks Rajesh
>
> > > But...it doesn't work
> > > It complains about form0 doesn't have cleaned_data. I guess
>
> > > form0 = super(MyFormWizard, self).get_form(0, data=data)
>
> > > only gives you aformwith no data?!
>
> > I just dpasted something that will help you capture the channelType
> > fromstep0 and then use it when thestep1formis being created.
>
> >http://dpaste.com/hold/72763/
>
> > If that doesn't work, please dpaste your MyFormWizard code.
>
> > -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set queryset on the second step of a form wizard?

2008-08-20 Thread rr

It works well. Thanks a lot.

But now another problem. It seems "def done " is not working. It loops
back to the step1 and def done is never called

And do you mind explain how your code works? I did a "print step"
before return form in the def get_from, it prints 0, 1, 0. It seems it
has been called 3 times when submit in the second step

What is the sequence of the call of process_step and get_form? the
docs didn't explain much about this

Thanks in Advance!!
-r

On Aug 20, 4:59 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Aug 20, 12:57 pm, rr <[EMAIL PROTECTED]> wrote:
>
> > Thanks Rajesh
>
> > But...it doesn't work
> > It complains about form0 doesn't have cleaned_data. I guess
>
> > form0 = super(MyFormWizard, self).get_form(0, data=data)
>
> > only gives you aformwith no data?!
>
> I just dpasted something that will help you capture the channelType
> fromstep0 and then use it when thestep1formis being created.
>
> http://dpaste.com/hold/72763/
>
> If that doesn't work, please dpaste your MyFormWizard code.
>
> -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set queryset on the second step of a form wizard?

2008-08-20 Thread rr

Thanks Rajesh

But...it doesn't work
It complains about form0 doesn't have cleaned_data. I guess

form0 = super(MyFormWizard, self).get_form(0, data=data)

only gives you a form with no data?!



On Aug 20, 11:06 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > Depending onstep1's selection, I want tosetthequerysetof one of
> > the fields (a ModelChoiceField)
>
> > e.g.
> > class StepOneForm(forms.Form):
> >    channelType =
> > forms.ModelChoiceField(queryset=ChannelType.objects.all())
> > class StepTwoForm(forms.Form):
> >    channel = forms.ModelChoiceField()
>
> > class MyFormWizard(FormWizard):
> >    def process_step(self, request,form,step):
> >         ifstep==0:
> >             self.get_form(1).channel.queryset=
> >form.cleaned_data['channelType'].channel_set.all()
>
> The process_step method is called only after theformis already
> validated. So, as you found out, that's not going to work. Also, you
> are trying tosetthequerysetonform#1 whenstepis 0. That's not
> going to persist.
>
> > But it doesn't seems working... how can a dynamic choice can be
> > achieved depending on selection of previousstep?!
>
> Try overriding the get_form method instead of process_step. Also, you
> will need to populateform#1'squerysetwhen you are instep1. So,
> the code would be something like this:
>
> def get_form(self,step, data=None):
>    form= super(MyFormWizard, self).get_form(step, data=data)
>     ifstep== 1:
>         # Getstep#0'sformandsetform#1'squerysetbased on it
>                 form0 = super(MyFormWizard, self).get_form(0, data=data)
>                form.fields['channel'].queryset=
> form0.cleaned_data['channelType'].channel_set.all()
>     returnform
>
> -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to set queryset on the second step of a form wizard?

2008-08-20 Thread rr

Hi Guru,

Depending on step 1's selection, I want to set the queryset of one of
the fields (a ModelChoiceField)

e.g.
class StepOneForm(forms.Form):
   channelType =
forms.ModelChoiceField(queryset=ChannelType.objects.all())
class StepTwoForm(forms.Form):
   channel = forms.ModelChoiceField()

class MyFormWizard(FormWizard):
   def process_step(self, request, form, step):
if step==0:
self.get_form(1).channel.queryset =
form.cleaned_data['channelType'].channel_set.all()

But it doesn't seems working... how can a dynamic choice can be
achieved depending on selection of previous step?!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---