Re: django-pdb on PyPI

2011-08-03 Thread Tom Christie
Thanks for that! Yeah there's nothing very complicated about it, but makes for 
a useful little package.
  T.

-- 
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/-/2YRroHhYj1EJ.
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: [django] Get request URL

2011-08-03 Thread Malcolm Box
The best you can do is look for a Referrer header in the request:

request.META['HTTP_REFERER']

which should be the URL of the originating page. However that may or may not
be there depending on user's browser etc etc.

Malcolm

On 3 August 2011 00:41, He Jibo  wrote:

> Hi, Djangoers,
>
> I am trying to write a page rank banner. *I need your help on how to get
> the request UR*L.  I want the function looks like this. If I put the
> following html snippet in a URL, for example,
> http://www.homesecurity361.com/index.html, I want the following code to
> show the page rank of this URL. I know how to calculate page rank after
> getting the URL. My problem is,* if the following code is put at
> http://www.homesecurity361.com/index.html, how can my own server,
> http://www.ueseo.net know which URL is requesting the image banner*, *
> http://www. ueseo.net/pagerank.gif* ? Thanks so much.
>
> *http://www.ueseo.net/"; title="Search Engine Optimization"
> target="_blank">http://www. ueseo.net/pagerank.gif" alt="Search
> Engine Optimization" style="border: 0;">
> *
>
> ---
> He Jibo
> Department of Psychology,
> Beckman Institute for Advanced Science and Technology
> University of Illinois, Urbana Champaign,
> 603 East Daniel St.,
> Champaign, IL 61820
> website: www.hejibo.info
>
> --
> 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.
>



-- 
Malcolm Box
malcolm@gmail.com

-- 
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: Django for a front end designer

2011-08-03 Thread Malcolm Box
On 2 August 2011 18:49, bruno desthuilliers
wrote:

>
> As far as I'm concerned, OSX is a pain (as a programming platform)
> whaver language / techno you want to use.
>
>
Don't be put off by this - it's certainly not my (nor many, many other
people's) experience of programming on OS X.

>From my experience, it rocks as a place to program:

- If you want to write Mac or iPhone code, XCode is an amazing IDE
- If you want to write stuff to deploy onto a Unix server, you have all the
tools, libraries and stuff already working (OS X is Unix under the hood) -
but cf Linux the available tools (editors etc) are superior.
- If you want to write Windows code then you can run a Windows VM and have
everything safely sealed off
- It's all wrapped in a package that "just works" and gets out of the way.
So you don't have to spend hours twiddling obscure X-Windows settings to get
a desktop that works. Oh, and the battery life is good.

Malcolm

-- 
Malcolm Box
malcolm@gmail.com

-- 
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: Django docs and GSoC doc summit

2011-08-03 Thread adam

great

On 08/03/2011 01:44 AM, Russell Keith-Magee wrote:

On Tue, Aug 2, 2011 at 6:43 PM, eset  wrote:

hi,

I am new to the Django list but I am a django fan (we dev with Django
for www.booki.cc)... anyways I wanted to encourage the Doc team and
individuals on the list to apply for the GSoC Documentation Summit
(details below):
https://sites.google.com/site/docsprintsummit/

You can apply as an individual or a group.  Applications close Friday
(5th), application process takes about 2-5 mins :)


Hi Adam,

Thanks for drawing our attention to this. This sounds like a great
opportunity to hack on Django's docs -- I'll see if we can shake loose
some volunteers to attend.

For anyone

Yours,
Russ Magee %-)



--

--
Adam Hyde
Founder, FLOSS Manuals
Project Manager, Booki
Book Sprint Facilitator
mobile :+ 49 177 4935122
identi.ca : @eset
booki.flossmanuals.net : @adam

http://www.flossmanuals.net
http://www.booki.cc
http://www.booksprints.net

--
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: Django for a front end designer

2011-08-03 Thread Andre Lopes
If you want to start with a PHP Framework, consider CodeIgniter. It is
the easier Framework for a starter.


On Tue, Aug 2, 2011 at 3:46 PM, paulo couto  wrote:
> Ok thanks for the clarifications :
> I guess i'll go to PHP for now and when i have more prog. experience i'll
> try python and django to be able to build my own stuff from scratch.
> Now i only need to find where to start in PHP :)
> Thanks all for your time.
>
> 2011/8/2 webcomm 
>>
>> On Aug 2, 4:57 pm, "biofob...@gmail.com"  wrote:
>> > Thank you all for the advices/sugestions.
>> > For what i read most of you advice on PHP + framework and i can
>> > understand that. I looked at django and rails as a option for me to
>> > have. My PHP knowledge is very limited, and sometimes i need some
>> > functionality on a wordpress site or on a textpattern one but my
>> > knowledge doest allow me to do much. Thats when i "feel" i need to
>> > learn some programing language in order to be able to do what i have
>> > in mind.
>>
>> Writing a WordPress plugin might be a good initial goal for you.  It's
>> been a while since I wrote one, but it's fairly easy if I remember
>> right.  Though nothing's perfectly easy when you're just getting
>> started.
>>
>> If you're going to start with a little PHP -- or regardless of the
>> language you start with -- I would go to a physical bookstore, look
>> through some books until you find something that makes sense to you,
>> buy it, and then work up to writing a WordPress plugin (if you go
>> PHP).
>>
>> Like I said, ultimately I think python may be a cut above PHP, but I
>> think it would be a steep climb for various reasons not related to the
>> language itself, and you wouldn't get much satisfaction for a while.
>> And it wouldn't help you do custom work in WordPress, of course.
>>
>> If you do want to try Python at some point, I'd urge you to install
>> Ubuntu (linux) on your computer and get comfortable with that first.
>> It's much easier to do Python work in linux.  Plus, it's a great
>> operating system.  I tried working with python on Windows XP for a
>> long time, and that slowed me down a lot.  For PHP, I don't think the
>> operating system matters quite as much.  If you want to do PHP in OSX,
>> get XAMPP: http://www.apachefriends.org/en/xampp-macosx.html
>>
>> -Ryan
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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: Django for a front end designer

2011-08-03 Thread Bruce Dou
Or you can try Rails.

On Wed, Aug 3, 2011 at 4:15 PM, Andre Lopes  wrote:

> If you want to start with a PHP Framework, consider CodeIgniter. It is
> the easier Framework for a starter.
>
>
> On Tue, Aug 2, 2011 at 3:46 PM, paulo couto  wrote:
> > Ok thanks for the clarifications :
> > I guess i'll go to PHP for now and when i have more prog. experience i'll
> > try python and django to be able to build my own stuff from scratch.
> > Now i only need to find where to start in PHP :)
> > Thanks all for your time.
> >
> > 2011/8/2 webcomm 
> >>
> >> On Aug 2, 4:57 pm, "biofob...@gmail.com"  wrote:
> >> > Thank you all for the advices/sugestions.
> >> > For what i read most of you advice on PHP + framework and i can
> >> > understand that. I looked at django and rails as a option for me to
> >> > have. My PHP knowledge is very limited, and sometimes i need some
> >> > functionality on a wordpress site or on a textpattern one but my
> >> > knowledge doest allow me to do much. Thats when i "feel" i need to
> >> > learn some programing language in order to be able to do what i have
> >> > in mind.
> >>
> >> Writing a WordPress plugin might be a good initial goal for you.  It's
> >> been a while since I wrote one, but it's fairly easy if I remember
> >> right.  Though nothing's perfectly easy when you're just getting
> >> started.
> >>
> >> If you're going to start with a little PHP -- or regardless of the
> >> language you start with -- I would go to a physical bookstore, look
> >> through some books until you find something that makes sense to you,
> >> buy it, and then work up to writing a WordPress plugin (if you go
> >> PHP).
> >>
> >> Like I said, ultimately I think python may be a cut above PHP, but I
> >> think it would be a steep climb for various reasons not related to the
> >> language itself, and you wouldn't get much satisfaction for a while.
> >> And it wouldn't help you do custom work in WordPress, of course.
> >>
> >> If you do want to try Python at some point, I'd urge you to install
> >> Ubuntu (linux) on your computer and get comfortable with that first.
> >> It's much easier to do Python work in linux.  Plus, it's a great
> >> operating system.  I tried working with python on Windows XP for a
> >> long time, and that slowed me down a lot.  For PHP, I don't think the
> >> operating system matters quite as much.  If you want to do PHP in OSX,
> >> get XAMPP: http://www.apachefriends.org/en/xampp-macosx.html
> >>
> >> -Ryan
> >>
> >> --
> >> 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.
> >>
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>


-- 
A decathlon Developer & programmer
http://blog.eood.cn/

-- 
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: Constructing / rendering a complex

2011-08-03 Thread Michał Sawicz
Dnia 2011-08-03, śro o godzinie 10:34 +1000, Sam Walters pisze:
> Hi i dont see what is complex about this.
--8<--
> The view 'rendering' as much as possible. So i assume you would rather
> have an initial template rendered. then perhaps have views that
> deliver data via JSON or something? AJAX+JSON

No, I mean I want to have the view only prepare the data, not describe
its visual properties like col/rowspan.

> I cant see why it would be impossible to change. Use javascript to
> change the table col and rowspans. (why do visual formatting work on
> the serverside if you can do it clientside)
> at the very least you can have style="display:None" and variious other
> CSS rules to help with any dynamic changes to the table.

I'm not going into JS at all at the moment. I'd like the table to be
rendered static in the template.

> I dont quite understand this one. If you are comparing data
> server-side then submitting data via a form would be recommended.
> Where is the data being changed that requires the comparison anyway?

I mean comparing forloop.counters with column/row/header/whatnot count
and rendering differently. No forms involved here, just a dynamic
dataset.

> use multiple classes eg  jse a javascript library to
> add remove classes select child elements of the DOM im sure the
> information doesnt have to be partitioned down the a super fine level
> of granularity requiring individual id's for every element does it?

Yes I'll probably try and run with that approach, I'll prepare the whole
grid within the view, and then "merge" cells that I need spanning in the
template. 

> What javascript library do you use? jquery, prototype, dojo etc all
> good options to simplify manipulation of DOM elements.

Yes, I use jQuery, but as stated before I need to create the table in
HTML without client-side tweaks.

Thanks for the comments, keep 'em coming ;)
-- 
Michał (Saviq) Sawicz 


signature.asc
Description: This is a digitally signed message part


Re: Django for a front end designer

2011-08-03 Thread 枯藤天涯
django is best for you,.beacuse it is writed by Python.and python is a
 clear language.

2011/8/3 Bruce Dou 

> Or you can try Rails.
>
>
> On Wed, Aug 3, 2011 at 4:15 PM, Andre Lopes wrote:
>
>> If you want to start with a PHP Framework, consider CodeIgniter. It is
>> the easier Framework for a starter.
>>
>>
>> On Tue, Aug 2, 2011 at 3:46 PM, paulo couto  wrote:
>> > Ok thanks for the clarifications :
>> > I guess i'll go to PHP for now and when i have more prog. experience
>> i'll
>> > try python and django to be able to build my own stuff from scratch.
>> > Now i only need to find where to start in PHP :)
>> > Thanks all for your time.
>> >
>> > 2011/8/2 webcomm 
>> >>
>> >> On Aug 2, 4:57 pm, "biofob...@gmail.com"  wrote:
>> >> > Thank you all for the advices/sugestions.
>> >> > For what i read most of you advice on PHP + framework and i can
>> >> > understand that. I looked at django and rails as a option for me to
>> >> > have. My PHP knowledge is very limited, and sometimes i need some
>> >> > functionality on a wordpress site or on a textpattern one but my
>> >> > knowledge doest allow me to do much. Thats when i "feel" i need to
>> >> > learn some programing language in order to be able to do what i have
>> >> > in mind.
>> >>
>> >> Writing a WordPress plugin might be a good initial goal for you.  It's
>> >> been a while since I wrote one, but it's fairly easy if I remember
>> >> right.  Though nothing's perfectly easy when you're just getting
>> >> started.
>> >>
>> >> If you're going to start with a little PHP -- or regardless of the
>> >> language you start with -- I would go to a physical bookstore, look
>> >> through some books until you find something that makes sense to you,
>> >> buy it, and then work up to writing a WordPress plugin (if you go
>> >> PHP).
>> >>
>> >> Like I said, ultimately I think python may be a cut above PHP, but I
>> >> think it would be a steep climb for various reasons not related to the
>> >> language itself, and you wouldn't get much satisfaction for a while.
>> >> And it wouldn't help you do custom work in WordPress, of course.
>> >>
>> >> If you do want to try Python at some point, I'd urge you to install
>> >> Ubuntu (linux) on your computer and get comfortable with that first.
>> >> It's much easier to do Python work in linux.  Plus, it's a great
>> >> operating system.  I tried working with python on Windows XP for a
>> >> long time, and that slowed me down a lot.  For PHP, I don't think the
>> >> operating system matters quite as much.  If you want to do PHP in OSX,
>> >> get XAMPP: http://www.apachefriends.org/en/xampp-macosx.html
>> >>
>> >> -Ryan
>> >>
>> >> --
>> >> 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.
>> >>
>> >
>> > --
>> > 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.
>> >
>>
>> --
>> 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.
>>
>>
>
>
> --
> A decathlon Developer & programmer
> http://blog.eood.cn/
>
> --
> 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.
>

-- 
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: Django session + dynamic form + model form

2011-08-03 Thread Tom Evans
On Wed, Aug 3, 2011 at 4:57 AM, sasa1...@gmail.com  wrote:
> Thank you, DR. But I tried that before and it did not work for some reason.
> It basically skips "if Answer.is_valid():" and goes to "else".
>
>    voss
>

I think this is because you are abusing your model form, and hence it
is not valid.

You should not be setting choices on a ModelMultipleChoiceField, you
should be supplying a queryset that describes the choices you want.
When validating the form, django will check that the submitted values
are contained in the ModelMultipleChoiceField's queryset.

Furthermore, ModelMultipleChoiceField will normally have id ->
description mapping, where as you have description -> description, eg
it should generate this HTML - London,
where as you have it generating London. It's just wrong. I guess you are
trying to do this to control the label generated - you should be doing
this[1].

So recap:
Don't assign choices to a ModelMultipleChoiceField, assign a queryset
Use a custom ModelMultipleChoiceField subclass to control how each
model is displayed.

Cheers

Tom

[1] https://docs.djangoproject.com/en/1.3/ref/forms/fields/#modelchoicefield

I can't link to the block of text directly, look for this:

"""
The __unicode__ method of the model will be called to generate string
representations of the objects for use in the field's choices; to
provide customized representations, subclass ModelChoiceField and
override label_from_instance. This method will receive a model object,
and should return a string suitable for representing it.
"""

-- 
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.



How to use less css in mac?

2011-08-03 Thread Jithin Emmanuel
Can some one please point out how to use less css along with compressor 
extension?
I use mac 10.6.8 and I am trying to use an existing project which was 
initially setup in windows.

I am trying to figure out what I should give here.
COMPRESS_PRECOMPILERS = (   
  
('text/less',""),
) 

Any help appreciated.

-- 
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/-/nnoVtL0_WgAJ.
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: How to use less css in mac?

2011-08-03 Thread Tom Evans
On Wed, Aug 3, 2011 at 10:10 AM, Jithin Emmanuel  wrote:
> Can some one please point out how to use less css along with compressor
> extension?
> I use mac 10.6.8 and I am trying to use an existing project which was
> initially setup in windows.
> I am trying to figure out what I should give here.
> COMPRESS_PRECOMPILERS = (
>
>     ('text/less',""),
> )
> Any help appreciated.
>

Hadn't come across less css before, looks interesting - well, looks
how I wanted CSS to behave 10 years ago.

Does this help? Seems to have examples for less

http://django_compressor.readthedocs.org/en/latest/settings/#compress-precompilers

Cheers

Tom

-- 
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: How to use less css in mac?

2011-08-03 Thread francescortiz
LESS combines CSS and javascript which I think that goes beyond the
safe line, so I vote for SCSS ( http://sass-lang.com/ ) that also has
a python version ( http://github.com/Kronuz/pyScss ).

LESS is based on an "older" version of SCSS that didn't follow CSS
syntax (SASS).

On Aug 3, 1:52 pm, Tom Evans  wrote:
> On Wed, Aug 3, 2011 at 10:10 AM, Jithin Emmanuel  wrote:
> > Can some one please point out how to use less css along with compressor
> > extension?
> > I use mac 10.6.8 and I am trying to use an existing project which was
> > initially setup in windows.
> > I am trying to figure out what I should give here.
> > COMPRESS_PRECOMPILERS = (
>
> >     ('text/less',""),
> > )
> > Any help appreciated.
>
> Hadn't come across less css before, looks interesting - well, looks
> how I wanted CSS to behave 10 years ago.
>
> Does this help? Seems to have examples for less
>
> http://django_compressor.readthedocs.org/en/latest/settings/#compress...
>
> Cheers
>
> Tom

-- 
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: About user auth page

2011-08-03 Thread Derek
On Aug 3, 8:28 am, Bruce Dou  wrote:
> Why there is not a default user login, user register template?
> And Can not find some examples.
>
> What is your advice to create user auth pages?
The Django Admin has a default user register template; you'll be asked
to create default user when you run 'manage.py syncdb'. See:
https://docs.djangoproject.com/en/dev/topics/auth/#installation
Further on you will find examples of managing users via code (a
perhaps more common way is via the web interface).

-- 
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: About user auth page

2011-08-03 Thread william ratcliff
I might also recommend using the django-registration package.

Best,
William

On Wed, Aug 3, 2011 at 10:10 AM, Derek  wrote:

> On Aug 3, 8:28 am, Bruce Dou  wrote:
> > Why there is not a default user login, user register template?
> > And Can not find some examples.
> >
> > What is your advice to create user auth pages?
> The Django Admin has a default user register template; you'll be asked
> to create default user when you run 'manage.py syncdb'. See:
> https://docs.djangoproject.com/en/dev/topics/auth/#installation
> Further on you will find examples of managing users via code (a
> perhaps more common way is via the web interface).
>
> --
> 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.
>
>

-- 
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.



Integrating Selenium tests into Django unit tests.

2011-08-03 Thread Shawn Milochik

I'm hoping someone can help me improve this process.

Short:

I want to run Selenium tests during Django's unit tests.

When 'manage.py test' is running, there's no dev server available 
for Selenium.


If I run my Django app separately, changes to the database are 
cumulative instead of discrete, like Django's own tests.


My current solution:

I have a bash script that re-loads my local database from my test 
fixtures then runs my app (via gunicorn) in the background.


Then I run 'manage.py test' and my tests (including the Selenium 
tests) run.


Afterwards, my bash script sends a 'kill' command to the process ID 
of my gunicorn script.


This works, but:

The Selenium tests each run from the same database, so db changes 
are cumulative.


I have to create the database each time, separate from the one 
Django's TestCase instances are using.
This also replaces my local development database each time, which 
isn't a problem because I reload it from the fixtures regularly anyway, 
but is mildly inconvenient.


Alternative method:

It's possible to use subprocess in a TestCase setUp and tearDown to 
launch the Django dev server each time. This fixes the fixture refresh 
issue.
However, this requires a separate settings.py file for testing to 
set the "default" database settings to what the real settings.py file 
uses for the test database.
I don't like this solution because it makes it impossible to use an 
in-memory sqlite3 database and the interaction with the command line via 
subprocess gets messy.


I found django-nose-selenium via a Google search, but it requires the 
Java Selenium server to be running. It also adds a lot of extra stuff to 
my project: installed apps, extra settings, extra command-line commands 
required, and more complicated TestCases. I'm just using the Selenium 
webdriver in a unittest.TestCase and it works great without any of that. 
I don't want to add all that complexity just to get fresh fixtures for 
each test.


Thanks,
Shawn


--
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: Constructing / rendering a complex

2011-08-03 Thread sebastien piquemal
Hi !

I have written this small library a while ago : 
http://code.google.com/p/django-cube/
. It is not exactly what you are looking for, but one of the aim is
indeed easy generation of html tables. I don't know if it can be of
any help to you, but you could check how the template tag is written
for example...

Cheers,

Sébastien

On Aug 3, 11:25 am, Michał Sawicz  wrote:
> Dnia 2011-08-03, śro o godzinie 10:34 +1000, Sam Walters pisze:
>
> > Hi i dont see what is complex about this.
> --8<--
> > The view 'rendering' as much as possible. So i assume you would rather
> > have an initial template rendered. then perhaps have views that
> > deliver data via JSON or something? AJAX+JSON
>
> No, I mean I want to have the view only prepare the data, not describe
> its visual properties like col/rowspan.
>
> > I cant see why it would be impossible to change. Use javascript to
> > change the table col and rowspans. (why do visual formatting work on
> > the serverside if you can do it clientside)
> > at the very least you can have style="display:None" and variious other
> > CSS rules to help with any dynamic changes to the table.
>
> I'm not going into JS at all at the moment. I'd like the table to be
> rendered static in the template.
>
> > I dont quite understand this one. If you are comparing data
> > server-side then submitting data via a form would be recommended.
> > Where is the data being changed that requires the comparison anyway?
>
> I mean comparing forloop.counters with column/row/header/whatnot count
> and rendering differently. No forms involved here, just a dynamic
> dataset.
>
> > use multiple classes eg  jse a javascript library to
> > add remove classes select child elements of the DOM im sure the
> > information doesnt have to be partitioned down the a super fine level
> > of granularity requiring individual id's for every element does it?
>
> Yes I'll probably try and run with that approach, I'll prepare the whole
> grid within the view, and then "merge" cells that I need spanning in the
> template.
>
> > What javascript library do you use? jquery, prototype, dojo etc all
> > good options to simplify manipulation of DOM elements.
>
> Yes, I use jQuery, but as stated before I need to create the table in
> HTML without client-side tweaks.
>
> Thanks for the comments, keep 'em coming ;)
> --
> Michał (Saviq) Sawicz 
>
>  signature.asc
> < 1KViewDownload

-- 
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.



Integrating Selenium tests into Django unit tests.

2011-08-03 Thread Tom Christie
I just had to do the same thing. Tried to use the django-sane-testing package, 
but didn't have much success there. In the end this ticket here: 
https://code.djangoproject.com/ticket/2879 pretty much did the trick, with a 
bit of updating as it didn't quite work with >= 1.2. I'll see if I can get a 
snippet to ya some time shortly (or drop me a mail off-list: 
t...@tomchristie.com)
Cheers,
  T.

-- 
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/-/6A-k53jGSd8J.
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: Django for a front end designer

2011-08-03 Thread Sells, Fred
I had to learn basic Php for a class.  It's worth it to subscribe to
Lynda.com for a few months to get their online training videos.  Removes
much pain.  Like all training, it covers the basics and you really don't
know what you don't know until you try to do something.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of biofob...@gmail.com
Sent: Tuesday, August 02, 2011 4:58 PM
To: Django users
Subject: Re: Django for a front end designer

Thank you all for the advices/sugestions.
For what i read most of you advice on PHP + framework and i can
understand that. I looked at django and rails as a option for me to
have. My PHP knowledge is very limited, and sometimes i need some
functionality on a wordpress site or on a textpattern one but my
knowledge doest allow me to do much. Thats when i "feel" i need to
learn some programing language in order to be able to do what i have
in mind.

-- 
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.


-- 
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: Best practice when testing form values in a template?

2011-08-03 Thread Joshua Russo
Or am I not using these concepts as intended?

-- 
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/-/UvoTGqPzDBoJ.
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: Integrating Selenium tests into Django unit tests.

2011-08-03 Thread Shawn Milochik

Tom,

Thanks for the reply. I read the history of that ticket and it is 
exactly what I'm looking for. Too bad it's five years in the making and 
still not in trunk.


So, what did you do, use one of the patches in the ticket? If so, which 
one? If you have a snippet or something then please post to the list -- 
it may be helpful to others.


Thanks,
Shawn


--
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: Django session + dynamic form + model form

2011-08-03 Thread voss
Thank you, Tom. You are right! I shouldn't assign choices to a 
ModelMultipleChoiceField. That's what caused the problem. But instead of 
constructing a custom ModelMultipleChoiceField subclass, I abandoned "Model 
Form" and simply did the following, which worked!

class myForm(forms.Form):
Question = forms.ChoiceField(choices=[], widget=forms.RadioSelect())
def __init__(self, request, *args, **kwargs):
super(myForm, self).__init__(*args, **kwargs)
self.fields['Question'].choices = 
Model.objects.filter(**request.session['filter_dict']).values_list('city', 
'city').distinct()

And in views.py, 

def myAnswer(request):
Answer = myForm(request, request.GET or None)
if Answer.is_valid():
...
...

Once again, thank you for pointing out such important concept. It helped a 
lot!

cheers,

   voss  

-- 
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/-/CVaiGVkam1QJ.
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.



Batch upload data using ModelAdmin

2011-08-03 Thread Vasu Nagalingam
Hi - I am trying to upload data from a CSV file. But I have to do some
processing before saving the data (such as slugifying a field). I am
trying to use the example provided by fellow users on this thread
(http://groups.google.com/group/django-users/browse_thread/thread/
b12bfeb6af4978bb/88d3b1f40e3b4a8b?lnk=gst&q=modeladmin+as+a+batch
+function#88d3b1f40e3b4a8b).

I am having trouble understanding the flow. What does "cleaned_data"
do? Is it loading the entire file or just the first row? If latter,
where is it iterating?

I would appreciate if someone can shed some light on this routine, or
share how you implemented batch import of data using django models.
What I have is a CSV formatted data consisting of "school name,
address1, address2, city, state, url, school type" and I need to
create entries into the School Model, which requires an additional
"calculated" field of a slug (based on school name) and a school type
which is a Foreign Key to SchoolType. The latter two are what I am
trying to process before saving the model.

Help much appreciated.

-- 
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.



cannot import blank value to IntegerField()

2011-08-03 Thread Didymus
Hi,

I am experimenting with Django v1.3 and using a PostgreSQL db.

Having created the model and syncdb the db I next proceed to import
the data from a legacy db via a .csv file via a PostgreSQL command
prompt.

I have checked all the data.  What appears to be happening is that for
an IntegerField() if the column being imported contains no data the
PostgreSQL command prompt reports...

ERROR:  invalid input syntax for integer: ""
CONTEXT:  COPY train_emp, line 1, column phone: ""

The problem does not arise if I put a number into the column in
the .csv file.

I have tried the following code in models.py

phone  = models.IntegerField(blank=True)
phone  = models.IntegerField(null=True)
phone  = models.IntegerField(null=True, blank=True).

These do not work.

Thank you for your help.

-- 
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: ImportError only when Debug=False

2011-08-03 Thread Karen Tracey
On Tue, Aug 2, 2011 at 1:02 PM, George Cummins  wrote:

> On Tue, Aug 2, 2011 at 12:38 PM, Tom Evans wrote:
>
>> On Tue, Aug 2, 2011 at 3:17 PM, George Cummins 
>> wrote:
>> > While testing changes to an existing project, I disabled debugging.
>> While
>> > trying to restart the web server (uWSGI+nginix), I encountered the
>> following
>> > error:
>> >
>> > File "/opt/django-projects/preps/statistics/models.py", line 5, in
>> 
>> >
>> > from preps.games.models import FootballGame, VolleyballGame,
>> > GirlsBasketballGame, BoysBasketballGame, BaseballGame, SoftballGame
>> >
>> > ImportError: cannot import name VolleyballGame
>> >
>> > (Full traceback here: http://pastebin.com/AqzjTuLz)
>>
>

The traceback I see at that linked page does not at all match the
ImportError you report. What I see at the linked page is a traceback that
ends with:

File "/opt/django-projects/preps/../preps/statistics/models.py", line 196,
in 
class TeamVolleyballGame(models.Model):
File "/opt/django-projects/preps/../preps/statistics/models.py", line 198,
in TeamVolleyballGame
game = models.ForeignKey(VolleyballGame)
NameError: name 'VolleyballGame' is not defined

Which is it -- NameEror or ImportError?



> > This error does not occur when DEBUG=True, and does not occur when using
>> > Django's runserver whether debugging is on or off. It only occurs when
>> using
>> > my production stack ( Django 1.2.5+uWSGI+nginx ).
>> > [snip]
>> >
>>
>>
>> Django doesn't do anything differently, AFAIK (happy to be corrected).
>>
>>
There are differences in import order with DEBUG on/off and also with
runserver vs. production web server. When debug is on and a model is
registered to the admin, the admin code includes a validation step (
https://code.djangoproject.com/browser/django/tags/releases/1.3/django/contrib/admin/validation.py)
which fully loads all models. The runserver command similarly has a
validation step (that is performed regardless of DEBUG setting) that can
change the order in which files are imported compared to a production web
server. These differences in import order can result in ImportErrors (and
other errors) showing up only in certain environments.

[snip]


> In other places online, there are mentions of circular references causing
> this type of problem.
> I believe I have ruled out circular references as a problem, but the fact
> that they are known
> and ignored when debugging is enabled led me to believe there must be a
> difference in the
> load processes between debugging and non-debugging.
>
>
If you could provide the full ImportError traceback someone might be able to
help. Note these errors are not "ignored when debugging", rather DEBUG being
on can cause the import order to be different so that certain problems don't
manifest themselves.

Karen
-- 
http://tracey.org/kmt/

-- 
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.



Intro Tutorial-- Poll/Choice SQL writes

2011-08-03 Thread Gall
I'm working through the introductory tutorial @ djangoproject.com. Why
does the poll object require an explicit save() call, while choice
objects are inserted into the db instantaneously?

-- 
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: Best practice when testing form values in a template?

2011-08-03 Thread Joshua Russo
Really? Nothing? Do you need more information? From the lack of response I 
feel like I'm completely off the mark and nobody wants to tell me.

-- 
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/-/uMI0ls6prlEJ.
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: Best practice when testing form values in a template?

2011-08-03 Thread Shawn Milochik

On 08/03/2011 10:46 PM, Joshua Russo wrote:
Really? Nothing? Do you need more information? From the lack of 
response I feel like I'm completely off the mark and nobody wants to 
tell me. --


1: https://code.djangoproject.com/wiki/UsingTheMailingList

If you're not getting help then it's almost certainly because you 
haven't made it easy for the all-volunteer army to help you.


You posted code that shows a subclass of an unknown form, you have 
invalid code (it looks like self["multiLineInfo"] should be  
self.fields["multiLineInfo"]), and a template but no view to explain the 
context the template is processing.


What you should have done instead of pasting incomplete code is make the 
simplest working (or non-working, as the case may be) example that 
demonstrates your issue.


On top of that, replying with "Really? Nothing?" is a great way to get 
ignored. Nobody wants to help someone with that attitude.


So, to recap:
Read this, then re-post: 
https://code.djangoproject.com/wiki/UsingTheMailingList


Shawn




--
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.



Recommended management of static HTML files?

2011-08-03 Thread Rodney Topor
OK, I understand that static JavaScript files, stylesheets and images
should be stored in a /static/ directory and managed by the
django.contrib.staticfiles app.

But a typical project will contain both dynamic HTML pages generated
by Django and (possibly long) static HTML pages.  Such static HTML
pages could be managed using the django.contrib.flatpages app, the
django.contrib.staticfiles app, or by views that render a static
template.  Perhaps there are also other ways.

Can someone tell me which of these, presumably which of the first two
ways, is the recommended way to manage static HTML files?

If the answer is to use flatpages, is it OK to write flatpages that
load other static files such as JavaScript, CSS and JPGs?

Many thanks.

Rodney

-- 
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.



Run an application periodically on django

2011-08-03 Thread Mohamed Ghoneim
Hey guys,

I am new to djnago and I have heard a lot about its powerful capabilities,
so I preferred it over other web frameworks.

My problem is I have a webpage that its content should be updated
automatically every 30 seconds as I build an app that gets data from another
web page
and parse it and then updates my webpage.

My problem is how can I schedule this this app to run every 30 seconds? and
can I do this on a hosting website?
--
Mohamed Sayed Ghoneim

-- 
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: Run an application periodically on django

2011-08-03 Thread kenneth gonsalves
On Thu, 2011-08-04 at 08:12 +0300, Mohamed Ghoneim wrote:
> My problem is how can I schedule this this app to run every 30
> seconds? and can I do this on a hosting website?

djcelery or cron should do the trick

-- 
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.