Re: I have a problem with wizard.

2013-12-10 Thread Olga Burdonova

Solved by overwriting some methods but I still thinking about better 
solution.

class OrderWizard(SessionWizardView):
template_name = "order/wizard.html"

def get_form_key(self, step):
return "wizard_" + self.prefix + str(step)

def process_step(self, form):
self.request.session[self.get_form_key(self.get_step_index())] =  
self.get_form_step_data(form)

def render_done(self, form, **kwargs):
"""
This method gets called when all forms passed. The method should 
also
re-validate all steps to prevent manipulation. If any form don't
validate, `render_revalidation_failure` should get called.
If everything is fine call `done`.
"""
final_form_list = []
# walk through the form list and try to validate the data again.
import pdb
pdb.set_trace()
for form_key in self.get_form_list():
form_obj = self.get_form(step=form_key,
data=self.request.session[self.get_form_key(form_key)],
files=self.storage.get_step_files(form_key))
if not form_obj.is_valid():
return self.render_revalidation_failure(form_key, form_obj, 
**kwargs)
final_form_list.append(form_obj)

# render the done view and reset the wizard before returning the
# response. This is needed to prevent from rendering done with the
# same data twice.
done_response = self.done(final_form_list, **kwargs)
self.storage.reset()
return done_response



def done(self, form_list):
#form_data = utils.process_form_data(form_list)
import pdb
pdb.set_trace()
return HttpResponseRedirect('/page-to-redirect-to-when-done/')

-- 
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/14e1645c-8efb-4307-ae64-6ade6878a5a2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: I have a problem with wizard.

2013-12-10 Thread Olga Burdonova
I tested it with django 1.6 and 1.5 

-- 
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/6fd8f358-d348-4ae6-8e51-e3b0f588a033%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: I have a problem with wizard.

2013-12-10 Thread Rafael E. Ferrero
Good Work !!


2013/12/10 Olga Burdonova 

> I tested it with django 1.6 and 1.5
>
> --
> 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/6fd8f358-d348-4ae6-8e51-e3b0f588a033%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Rafael E. Ferrero

-- 
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/CAJJc_8V4DR7vdLyiV63kkpcEQ%2Bt3uAtNCOZKM12unGU0Z1atfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Best way to learn Django considering Python versions and etc.

2013-12-10 Thread Bruce Whealton
Hello all,
 So, I started looking at recommended reading on Django and a 
couple books referred me to first go through "The Definitive Guide To 
Django."  I have to admit some concern about reading a book on Django that 
is some 5 plus years old.  I've come to think of this as the information 
age and as such, anything over a certain number of years as being very 
problematic.  However, I did notice that the Bitnami Django stack does use 
Python 2.5 - the version I just downloaded... not even 2.7.x but 2.5.  
Another confusing thing is that the Bitnami Guide for what I 
just downloaded is radically different from what actually gets downloaded 
and setup.  I cannot even find the application or a similar folder to the 
app I created when I installed Django stack from Bitnami.  Even looking at 
the access_log was not very helpful. There are calls to /img/bitnami.png 
and a GET request to StartProject, which was the project name I chose 
during installation.  
   After trying to figure out this installation, I jumped back to 
"The Definitive Guide to Django" and jumping into chapter 2, I found 
success.  So. I'll probably move forward with the instructions in that text 
and hope that I'm not learning something outdated.  Again, this text is 
recommended as a prerequisite  for other texts, as it were.  
Any advice on this?   Has anyone had great success with Bitnami's Django 
stack?  
Here is another thing that has me a bit confused.  Coming from 
Drupal, Wordpress, etc, the thinking is that one should always get the 
latest version, at least the latest minor version, e.g. if running Drupal 
7.24 comes out and you are running Drupal 7.23, you are strongly encouraged 
to upgrade.  However, some of my reading and course work on Django 
discusses creating isolated environments that don't break when a new 
version is released.  What makes it such that if Django 1.65, or 1.7 comes 
out there is not an easy upgrade to the next latest edition without 
breaking things?  
   My intention is not to be critical, as I really like Python and 
Django.  Similar to learning Node.js and the specification of Dependencies, 
I have not read or found discussed in an online course, why one might not 
use the latest version of a dependency... or how one would be needing 
earlier versions of a dependency or a component of a framework.  
Thanks in advance for any advice,
Bruce 

-- 
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/0c2ac755-8bcb-40ec-8737-987e8b094ee0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I test my Django App on my Phone

2013-12-10 Thread mulianto
Hi,

I guest your django app will be a web app run in a browser inside your phone.

For the easy way you can use your browser , in firefox open tools - web 
developer - responsive design view

You can test your django app in some phone mode with available screen 
resolution preset and also rotate it just like in a phone or tab.

No need from real phone because in android or ios the browser engine will have 
the same rendered output. 

Or the easy way is use wifi to make the phone and dev machine can talk and 
access it as usual  via browser.

Hope helps ˆ⌣ˆ 

Sent from my iPhone

Mulianto
Blog : Http://bit.ly/19eKG8v



On 10 Des 2013, at 04:03, Juan Pablo Romero Bernal  
wrote:

> Hi,  
>> I suggest setting up a  URL using  no-ip.org or similar service.  No-ip.org 
>> is free at this level and works great, at least on Ubuntu and CentOS.  I 
>> haven't tried other OS's. 
> 
> Or you can use localtunnel (http://progrium.com/localtunnel/) it's easy to 
> install and works
> fine on most *NIX. 
> 
> -- 
> Juan 
> -- 
> 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/CAJK1Jg1XHcgYjzW6-1w%3DqUnJtVn1US9vAWLUiVABHd5nbH_Z4A%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/AEFD4F68-3818-4A38-8B16-02FBCCA9AE81%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best way to learn Django considering Python versions and etc.

2013-12-10 Thread Tom Evans
On Tue, Dec 10, 2013 at 4:57 PM, Bruce Whealton  wrote:
> Hello all,
>  So, I started looking at recommended reading on Django and a
> couple books referred me to first go through "The Definitive Guide To
> Django."  I have to admit some concern about reading a book on Django that
> is some 5 plus years old.  I've come to think of this as the information age
> and as such, anything over a certain number of years as being very
> problematic.  However, I did notice that the Bitnami Django stack does use
> Python 2.5 - the version I just downloaded... not even 2.7.x but 2.5.

Python has many versions. The most recent version of 2.5 is old, but
it is not decrepit (just yet). I would use 2.7 though.

> Another confusing thing is that the Bitnami Guide for what I
> just downloaded is radically different from what actually gets downloaded
> and setup.  I cannot even find the application or a similar folder to the
> app I created when I installed Django stack from Bitnami.  Even looking at
> the access_log was not very helpful. There are calls to /img/bitnami.png and
> a GET request to StartProject, which was the project name I chose during
> installation.
>After trying to figure out this installation, I jumped back to
> "The Definitive Guide to Django" and jumping into chapter 2, I found
> success.  So. I'll probably move forward with the instructions in that text
> and hope that I'm not learning something outdated.  Again, this text is
> recommended as a prerequisite  for other texts, as it were.
> Any advice on this?   Has anyone had great success with Bitnami's Django
> stack?

The bitnami stack is not django, it is a packaging of django. I would
not use it, and instead simply install the components you require.

The django manual contains a tutorial and extensive documentation, and
is built from the source code to which it refers. Whatever version of
django you install, referring to the django manual for that version
will give you correct tutorials and documentation.

> Here is another thing that has me a bit confused.  Coming from
> Drupal, Wordpress, etc, the thinking is that one should always get the
> latest version, at least the latest minor version, e.g. if running Drupal
> 7.24 comes out and you are running Drupal 7.23, you are strongly encouraged
> to upgrade.  However, some of my reading and course work on Django discusses
> creating isolated environments that don't break when a new version is
> released.  What makes it such that if Django 1.65, or 1.7 comes out there is
> not an easy upgrade to the next latest edition without breaking things?

No, isolated environments are so that your app does not break because
someone else's app on the same server was upgraded.

You should always use a supported version of django, and use the most
recent release of that version. You do not always have to use the most
recent version - just as long as it is a supported version, the most
recent release will have all security fixes in it.

Eg, 1.6 is the most recent version, and 1.6.0 (just called 1.6) is the
most recent release in that version, but you can quite happily
continue to use 1.5 (release 1.5.5) or 1.4 (release 1.4.10).

Each jump to a major version will come with changes that you will be
required to make to your project, possibly even to 3rd party apps (or,
if you can't manage this yourself, you will have to wait for the
author of the app to update to include support for the new version).
For that reason, you probably don't want to blithely update your
sites, but do it as part of an upgrade process. Eg for the most recent
release:

https://docs.djangoproject.com/en/1.6/releases/1.6/#backwards-incompatible-changes-in-1-6

It is slightly different to what I have described, Django has a
deprecation policy, features not pending deprecation in X.Y will work
in X.Y+1 and X.Y+2, features pending deprecation in X.Y will work in
X.Y+1 but not X.Y+2. This means that what commonly happens is a
release has a feature that is pending deprecation, you upgrade to the
release without rewriting/fixing the deprecated section, and then
update to the next version and find that your code is broken.

>My intention is not to be critical, as I really like Python and
> Django.  Similar to learning Node.js and the specification of Dependencies,
> I have not read or found discussed in an online course, why one might not
> use the latest version of a dependency... or how one would be needing
> earlier versions of a dependency or a component of a framework.
> Thanks in advance for any advice,
> Bruce

The reason we version software is so that the API can be fixed at
particular points. If you write your site for django 1.2, and then
install django 1.6, it (probably) will not work.

Cheers

Tom

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

Re: Best way to learn Django considering Python versions and etc.

2013-12-10 Thread Alex Mandel
On 12/10/2013 09:54 AM, Tom Evans wrote:
> 
> It is slightly different to what I have described, Django has a
> deprecation policy, features not pending deprecation in X.Y will work
> in X.Y+1 and X.Y+2, features pending deprecation in X.Y will work in
> X.Y+1 but not X.Y+2. This means that what commonly happens is a
> release has a feature that is pending deprecation, you upgrade to the
> release without rewriting/fixing the deprecated section, and then
> update to the next version and find that your code is broken.
> 
>>My intention is not to be critical, as I really like Python and
>> Django.  Similar to learning Node.js and the specification of Dependencies,
>> I have not read or found discussed in an online course, why one might not
>> use the latest version of a dependency... or how one would be needing
>> earlier versions of a dependency or a component of a framework.
>> Thanks in advance for any advice,
>> Bruce
> 
> The reason we version software is so that the API can be fixed at
> particular points. If you write your site for django 1.2, and then
> install django 1.6, it (probably) will not work.
> 
> Cheers
> 
> Tom
> 


Right this is closer to say the difference between Drupal 5,6,7
Django just uses the 2nd level numbering to indicate api compatibility.
So 1.4.x,1.5.x,1.6.x would be the django world equivalent. ie some
migration or code change is involved to move. Keep in mind that Drupal,
Wordpress etc are also release products, not frameworks - you can run
Drupal or Wordpress without writing any code. You can not do the same
for Django. Django is intended to help you write custom websites.

Enjoy,
Alex

-- 
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/52A7916C.7050104%40wildintellect.com.
For more options, visit https://groups.google.com/groups/opt_out.


Writing your first Django app, part 1 (1.6)

2013-12-10 Thread Suhendri
Hi,

I'm new in Django, I'm excited with Django so I have to following the 
existing tutorial to knew how to create a program with Django.

I started with tutorial 1, Writing your first Django app, part1. I used 
Django 1.6 and SQLite


I followed the instructions from the starting of the tutorial, until the 
line of *# Create three choices* I got an error.

When I typed p.choice_set.create(choice_text='Not much', votes=0), I got an 
error:
*AttributeError: Traceback (most recent call last):*
*...*
*AttributeError: 'Choice' object has no attribute 'question'*

I followed the tutorial exactly as it shown on web, but I got an error on 
that line. Did I missed something in the tutorial ?

Could you help me, to solve this problem so i can continue learn the 
tutorial.

-- 
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/8714d33c-ab05-4a70-b88f-b3b52707549e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best way to learn Django considering Python versions and etc.

2013-12-10 Thread rettevhcirlu
Dear Bruce,
being myself a Python programmer for more than 16 years I only recently 
started usind django when I was looking for a way to set up a web 
application. The reason for this choice is motivated by the positive 
experience I always had with Python and so I dived into Django. Now when it 
comes to Python programming there is always this 2.X vs 3.X thing and this 
is also something one immediately has to deal with when it comes to Django 
programming. Setting up Apache and using mod_wsgi, calling a local Django 
installation set up with virtualenv, I directly ran into the problem that 
mod_wsgi can only work with a Django version using the same Python version 
mod_wsgi was compiled against. Since I am running a gentoo linux and 
therefore used to keep things relatively up to date, I decided to use 
Django version 1.6 and Python version 3.3. Of course then I discovered that 
this renders almost 80-90% of the additional Django packages, which make 
Django so powerful, "useless" because they are still with the old Python 
2.7 version. Just as an example: using Python 3.3 kicks out all Django 
based web shop framworks (to my best knowledge) and reduces the useable 
internationalization packages to only two ot three. And so on.
Therefore I personally recommend using Pyhton 3.3 only if one is safe with 
Python programming and if one has the time to do some things from scratch. 
If we are talking about different Django versions (I know you where talking 
about different Django versions only, but I thought it is worth having a 
look at the Python version as well): I realized that there where quite 
heavy changes in the framework over the different versions, and assuming 
that such a tendency will remain it would be better to use the newest 
stable version of Django instead of an old version where you probably have 
to rewrite large parts of the code when porting to a newer version.
Regarding literature the most useful one is the 1000+ pages Django doc. 
This is a really excellent documentation, and since Django is progressing 
quite fast, it will the most useful reading on this topic. Of course there 
are also excellent code snippets on certain Django topics on the web.
In the very beginning, when playing around with Django, I also used tried 
the Bitnami Django stack, but personally I didn't find it very useful.
Best wishes,
Ulrich

-- 
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/3261a455-aecb-4d9d-93f0-01cb2f5800cc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Writing your first Django app, part 1 (1.6)

2013-12-10 Thread Joey Chang
can you share more lines you typed before. It's hard to analysis depending
on just one line


2013/12/11 Suhendri 

> Hi,
>
> I'm new in Django, I'm excited with Django so I have to following the
> existing tutorial to knew how to create a program with Django.
>
> I started with tutorial 1, Writing your first Django app, part1. I used
> Django 1.6 and SQLite
>
>
> I followed the instructions from the starting of the tutorial, until the
> line of *# Create three choices* I got an error.
>
> When I typed p.choice_set.create(choice_text='Not much', votes=0), I got
> an error:
> *AttributeError: Traceback (most recent call last):*
> *...*
> *AttributeError: 'Choice' object has no attribute 'question'*
>
> I followed the tutorial exactly as it shown on web, but I got an error on
> that line. Did I missed something in the tutorial ?
>
> Could you help me, to solve this problem so i can continue learn the
> tutorial.
>
> --
> 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/8714d33c-ab05-4a70-b88f-b3b52707549e%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CANURRHDqJK5%2BBDhb1G2F6X_WXxkSJXeNz3YqPE42KKGbbD-DVg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Get a memory profile for a django site?

2013-12-10 Thread Christopher Welborn
I have a small personal site that runs on django, it's not a 
money-maker, and doesn't get a lot of traffic. I'm not so much a 
web-developer as I am an all-around programming enthusiast. I would like 
to find out how much memory a certain page or template/view is using. I 
know how much the apache process is using, and I know there are ways to 
profile python applications, I just don't know exactly where to go to 
get a nice picture and breakdown of what my django apps/pages are using.


I've tried django-profiling-dashboard, but there were a couple issues I 
had to deal with and now I don't think I'm getting an accurate picture.
What I mean is, I'm running Django 1.6 and Python 3.3, and 
profiling-dashboard had a small error with that setup. It was using the 
old django.conf.urls.default. I fixed that easily by patching it myself, 
only to find out that one of its dependencies (django-query-exchange) 
had the same error, plus more errors related to Django >= 1.5 and Python 
> 2.7. I hacked around those too, and got the dashboard running, but 
its kinda buggy (I haven't put a lot of time into it, as I wanted to ask 
some pros first). It gives me a profile that says '15Mb total', which I 
don't think is true. I think it's giving me a profile for only part of 
my site, but I wouldn't know which part. On my dev machine I have 2 
apache processes that report ~8000 with the `ps` command fresh, and 
~45000 each when I connect locally and the landing page is served.

(thats with DEBUG==True, and debug-toolbar and all)

Does anyone know how to get a memory-profile/breakdown on a Django 
1.6/Python 3.3 site? Any help would be much appreciated. All of this 
doubles as a learning experience, and none of it is critical, so any and 
all ideas are welcome. Maybe even just a link to some reading material?


--

- Christopher Welborn 
  http://welbornprod.com

--
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/l88uvt%2451j%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.


Best practice for utilizing vagrant and virtual env

2013-12-10 Thread Blake Adams
I am following the getting started with Django tutorial and managed to finish 
the 1st project but when I re-entered Vagrant SSH all packages i installed on 
my vagrant shared folder and my virtual environment were gone.  I think it 
might be because virtual box has several different version of my precise box. 
This might be whats causing the missing Envs and packages that ive already 
installed. It seems like im doing something wrong spinnng up the vagrant 
instance.

Whats is best practice for setting up a development environment once in Vagrant 
SSH?

Currently i have done:
1) Vagrant SSH
2) Installed default python packages (pip, dev, git, etc.)
3) Install Virtual env
4) CD to shared folder (ie /vagrant)
5) Create virtual env ( 'virtualenv env_name')
6) Source virtual env (source env_name/bin/activate)
7) Install Virtual env pkgs (ie. Django, pyscho2, etc.)

Once im done for the day:

8) deactivate virtual env
9) exit out of ssh
10) vagrant halt

Is this generally the correct workflow? I'm confused about step 5 in 
particular. Is this the correct way to create the virtual env or should I 
default to a different folder (the tutorial starts the folder with '~/')?. Am 
i'm shutting things down properly?

Any help would be appreciated - Thanks in advance!

Windows 7 (Cygwin)
Python 2.7x
Django 1.5x
Vagrant 1.3

-- 
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/e903831d-816b-43a2-88f2-ad27caa5934f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.