About user auth page

2011-08-02 Thread Bruce Dou
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?

-- 
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: Pyjamas and django server setup - how do *you* do it?

2011-08-02 Thread Bruce Dou
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?

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



Pyjamas and django server setup - how do *you* do it?

2011-08-02 Thread funk
Hi djangonauts,

what is your perfect setup of serving pyjamas static html, js, css
files and django as magic service over the web?
I really don't get it with best apache (or whatever) configuration. I
have eg. /services/ but how do *you* setup your url
redirection?

thx for all input.

Frank

-- 
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 can't see my static files

2011-08-02 Thread Guillaume Chorn
Ok, so I did use quotes in my link, and I changed my STATIC_URL setting (in
settings.py) from '/static/' to 'http://127.0.0.1:8000/static/' (I am
currently using the built-in development server at this address), but still
no luck.

I'm not sure exactly what you mean by my "staticfiles settings."  (Sorry,
once again I'm a total beginner so please bear with me.)  My current
settings related to static files in 'settings.py' are as follows:

STATIC_ROOT = ''
STATIC_URL = 'http://127.0.0.1:8000/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_DIRS =
('/Users/guillaumechorn/Documents/website/mainapp/static')
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
)

Below are the full contents of my urls.py file:

from django.conf.urls.defaults import *
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^home/$','mainapp.views.homepage'),
(r'^mainapp/$','mainapp.views.index'),
(r'^mainapp/(?P\d+)/$', 'mainapp.views.detail'),
(r'^products/$','mainapp.views.productindex'),
(r'^products/(?P\d+)/$','mainapp.views.productdetail'),
(r'^news/$','mainapp.views.news'),
(r'^events/(?P\d+)/$','mainapp.views.eventdetail'),
(r'^partners/$','mainapp.views.partners'),
(r'^admin/', include(admin.site.urls)),
)
urlpatterns += staticfiles_urlpatterns()

Once again, I'm using the following to link to my CSS file:



Am I still missing something?  Did I enter in anything incorrectly?

thanks,
Guillaume

On Tue, Aug 2, 2011 at 6:06 PM, Thomas Orozco wrote:

> Last thing, I made a typo, the address you could use should start with
> http, like: http://127.0.0.1/static/
> Le 2 août 2011 12:01, "Thomas Orozco"  a
> écrit :
>
> > A little detail, but you never know: you should put some ' ' in your
> link.
> > Like this :
> >
> > 
> >
> >
> > If there are spaces in your path, this could cause the lookup to fail.
> >
> > And even if that's not the case, don't rely on the user's browser to fix
> > coding mistakes.
> > Le 2 août 2011 10:28, "Guillaume Chorn"  a
> écrit :
> >> Thomas and Lokesh,
> >>
> >> Thanks very much for your help. I've modified the link in my HTML file
> to
> >> be:
> >>
> >>  }}stylesheet.css
> >> />
> >>
> >> where "stylesheet" is the name of the CSS file, and this file is located
> >> inside the directory listed under STATIC_DIRS in my settings.py file. As
> >> mentioned in my prior email, I also already have STATIC_URL = '/static/'
> > in
> >> my settings.py file, and I have the correct methods listed under
> >> STATICFILES_FINDERS.
> >>
> >> But it is still not working. Do I have a syntax error somewhere? Or am I
> >> still missing something in another file?
> >>
> >> thanks,
> >> Guillaume
> >>
> >> On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco <
> g.orozco.tho...@gmail.com
> >>wrote:
> >>
> >>> If your css file is locatedr in your staticfiles dir, you should use
> >>> something such as {{ STATIC_URL }}main.css, assuming your CSS file is
> > called
> >>> main and is located in one of the STATIC_DIRS.
> >>>
> >>> Using staticfiles_dirs in a template makes no sense. Not only your are
> >>> passing a parameter that has to do with your system configuration and
> not
> >>> your urls, but you are also using a directory instead of a file.
> >>>
> >>> In short, it is the static_url parameter that should be passed to form
> a
> >>> URL.
> >>> Le 1 août 2011 12:17, "Gchorn"  a écrit :
> >>>
> >>> > Hello All,
> >>> >
> >>> > I'm using Django to develop a website, and I'm having trouble getting
> >>> > it to see my static files. I've looked through Django's static file
> >>> > documentation and the steps I've taken to get Django to see my files
> >>> > (using a CSS file as an example) are as follows:
> >>> >
> >>> > First, I created a folder called "static" inside the main app folder
> >>> > for this project. Then, I added "/static/" to the STATIC_URLS section
> >>> > of the settings.py file, and I also added the full path to my CSS
> file
> >>> > under the STATICFILES_DIRS section of settings.py.
> >>> >
> >>> > Then I added the line:
> >>> >
> >>> > from django.template import RequestContext, loader
> >>> >
> >>> > As well as "context_instance= RequestContext(request)" as a third
> >>> > argument to the "return render_to_response()" call.
> >>> >
> >>> > Finally, in my url.py file, I added this line at the top:
> >>> >
> >>> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
> >>> >
> >>> > And this line at the bottom (separate from the initial "urlpatterns =
> >>> > patterns()" call):
> >>> >
> >>> > urlpatterns += staticfiles_urlpatterns()
> >>> >
> >>> > In my HTML/Django template, I added the following link to my CSS
> file:
> >>> >
> >>> > 
> >>> >
> >>> > But then after all of this, when I perform a "python manage.py
> >>> > runserver" to preview the website, Django

Re: Django session + dynamic form + model form

2011-08-02 Thread sasa1...@gmail.com
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

You've defined your form to expect a `request` argument, but then you 
haven't passed that argument.


answer = MyForm(request, request.GET or None)
--
DR.
--
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/-/3eYgahTEsy8J.

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.



Best practice when testing form values in a template?

2011-08-02 Thread Joshua Russo
Ok, so I've created a fairly simple form:


class OrganizationItemForm(AuditModelForm):
selected  = forms.BooleanField()  
extraRequired = forms.BooleanField(widget=forms.HiddenInput)
multiLineInfo = forms.BooleanField(widget=forms.HiddenInput)

def __init__(self, *args, **kwargs):
super(AuditModelForm, self).__init__(*args, **kwargs)
if self["multiLineInfo"].value():
self.fields["descr"].widget = 
forms.Textarea(attrs={"class":"descriptionEdit"})
else:
self.fields["descr"].widget = 
forms.TextInput(attrs={"class":"itemDescrEdit"}) 
self.fields["descr"].required = self["extraRequired"].value()

class Meta:
model = OrganizationItem

I use this as a single checkbox entry that could optionally have either a 
single line edit, multi-line edit, or no text box at all

The applicable section of the template looks like this:



{% for item in cat.items %}
{{ item.form.selected }} {{ item.label }}
{% if item.form.extraRequired.value or item.descrLabel %}  
{% if item.form.multiLineInfo.value %}

{% else %}
–
{% endif %}
{{ item.descrLabel }}
{% if item.form.multiLineInfo.value %}

{% else %}
 
{% endif %}
{{ item.form.descr }}
{% else %}
{{ item.form.descr.as_hidden }}
{% endif %}
{{ item.form.extraRequired }}
{{ item.form.multiLineInfo }}

{% endfor %}
 

Keep in mind, this is a work in progress. I've not integrated the error 
output yet. Right now my problem is that if I simply click submit to test 
all of the error conditions, the value of the hidden fields is a string. 
This seems to be because to_python is only called for the cleaned value. The 
cleaned data is only available after the form passes validation.

What is the best practice for carrying data like this in a form and using it 
in the templates to govern conditionals?

-- 
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/-/nvSquVbDnmMJ.
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-pdb on PyPI

2011-08-02 Thread Matt Schinckel
That's nice.

I've figured out how to enable this and django-devserver (since they both 
override 'runserver', they clash).

You can just install the middleware (dependent upon settings.DEBUG, 
naturally).

Documentation patch forthcoming.

Matt.

-- 
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/-/JIL0oVT7YFkJ.
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: Help please xml2-config from libxml2

2011-08-02 Thread theseventhletter
thank you sir, that did the trick..

On Aug 3, 12:24 am, Carlos Daniel Ruvalcaba Valenzuela
 wrote:
> Hello, your problem is most probably the lack of the development package for
> libxml2, try installing the libxml2-dev package via apt-get command or
> synaptic under Ubuntu.
>
> Regards,
> Carlos Ruvalcaba
> El 02/08/2011 15:39, "theseventhletter"  escribió:
>
>
>
>
>
>
>
> > Good Day to all
> > i been trying to install geodjango but always gets stuck up with this
> > error after i downloaded postGIS and typed ./configure on the
> > terminal.
>
> > configure: error: could not find xml2-config from libxml2 within the
> > current path. You may need to try re-running configure with a --with-
> > xml2config parameter.
>
> > ive used google to search for answer to this error but i haven't found
> > anything to fix this
>
> > im using ubuntu 11.04 in a VM (oracle)
>
> > thanks
>
> > --
> > 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: Constructing / rendering a complex

2011-08-02 Thread Sam Walters
Hi i dont see what is complex about this.

On Wed, Aug 3, 2011 at 6:35 AM, Michał Sawicz  wrote:
> Hi all,
>
> I'd like to pick your brainz about how would you approach constructing
> and rendering a complex table with headers, row/colspanning cells in a
> most clean way that rids the view of rendering as much as possible.
>

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

> Here's roughly what I'm after (incomplete, but you should see what I
> mean):
> http://imageshack.us/f/845/zrzutekranuqv.png/
>
> There are three approaches I can think of:
>
>     1. Construct a complete grid in the view, along with row/colspans
>        that I would simply iterate over and render in the template, but
>        that would make it virtually impossible to change the
>        appearance.

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.

>     2. Count the cells / rows and compare them with data from the view
>        to decide on how that particular cell should behave, but that
>        makes the template a nightmare.

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?

>     3. ID all the cells and change the attributes accordingly, but for
>        rowspanning cells I wouldn't know in the consecutive rows that
>        there in fact was a cell and I might want to repeat it. Maybe I
>        could fill in the complete grid but make the ones that get
>        spanned ignorable in the template through a class.
>

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?

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

> I'll take all thoughts :)
> --
> Michał (Saviq) Sawicz 
>

-- 
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: HttpRequest.META['SERVER_PORT'] is a string?

2011-08-02 Thread Thomas Orozco
Basically everything (ok, almost) in request.META is strings, so I guess it
would be pretty consistent if for some reason server port wasn't.

It's usually your job to normalize data that comes into your application
anyways.
Le 2 août 2011 23:04, "Roy Smith"  a écrit :
> I'm running django 1.3. If I access HttpRequest.META['SERVER_PORT'],
> I get back a string (i.e. "80"). I was expecting an integer. Is this
> a bug (in which case I'll open a ticket to fix it) or it it
> intentional that it's returning a string (in which case I'll open a
> ticket to document it better).
>
> --
> 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 docs and GSoC doc summit

2011-08-02 Thread Russell Keith-Magee
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 %-)

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



[django] Get request URL

2011-08-02 Thread He Jibo
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.



Re: Setting up multi-user site in Django without Admin access

2011-08-02 Thread Russell Keith-Magee
On Tue, Aug 2, 2011 at 11:53 AM, somecallitblues  wrote:
> Hey guys,
>
> I'm creating a site where multiple users will enter their details and
> get access to admin I want to create from them .I want to use default
> Django admin as a kind of Super User access for myself. I don't want
> these users to have access to Super User admin.
>
> I want them to have their own admins where they can enter some
> details, sync with an external web service and create some reports
> with the data I pull in from an external site.
>
> So, the way I imagine this is customer comes to my site and signs up.
> I generate a kind of console for them. They can access it via
> www.mysite.com/customername/console/ and get the reports from the
> console.
>
> What I'm not sure about is the following:
>
> -Can this be done in Django?

Yes. This sounds like a fairly vanilla usage of Django.

> -Would I use the inbuilt auth framework that's used also in admin or
> would I create another? I mean, should I create another Model for
> these users or use the existing one that's enabled in applications?

Unless you have some very specific requirements that the default auth
User doesn't provide (and can't provide through use of a Profile
model), the default Django admin should be enough.

> -Also,  how would I setup my urls.py to deal with this type of URL
> www.mysite.com/customername/console/? Should I just set it up to parse
> www.mysite.com/whatever/console/ and then use views.py to match the /
> customername/ part and pull in the info accordingly?

Essentially, yes. Set up a URL pattern that is something like:

   url(r'^(?P[a-zA-Z0-9_-]+)/console/$', console_view,
name='console-home')

And a view:

def console_view(request, customername):
   ...

and you're off and running. If your console will be more than a single
view, there are a bunch of things you could do to avoid duplicating
the  bit of the URL pattern in multiple URL patterns:

 * You could wrap all the console URLs in a separate urls.py file and
include() it at the top level;

 * You could define your console as a class, and use a get_urls()
method to do dispatch internally (see the source for Django's admin
for an example of this)

> I'm learning Django at the moment and it looks like a framework I can
> use for this project, but I just wanted to make sure this can be done
> before spending more time on it.

Everything you've described here sounds like fairly vanilla Django.

Best of luck!

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-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-02 Thread paulo couto
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.



Re: Dynamic page refreash

2011-08-02 Thread H . İbrahim Yılmaz
http://www.quackit.com/javascript/javascript_refresh_page.cfm

2011/8/2 lmcadory 

> I'm having this problem, my web design knowledge is limited and I'm
> having a hard time searching for the solution (if there is one)
>
> The problem is this:
>
> I have a view that counts the number of lines in a file. It then
> pushes that result to an html page. What I want it to do is when that
> line count changes when I press the refresh button on the browser it
> displays the new number. Right now I have to reload the server to
> display the results.
>
> I, if I'm asking the question correctly, is there a way I can tell the
> view to run again and republish the results?
>
> --
> 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.
>
>


-- 
http://www.arkeoloji.web.tr

-- 
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: Dynamic page refreash

2011-08-02 Thread bruno desthuilliers
On 2 août, 21:43, lmcadory  wrote:
> I fixed it. I needed to remove --noreload

This doesn't fix anything - try to run it using anything but the test
server and you'll have the same problem (or even worse in a multi-
threading or multi-process environment).

You actually have to  move the first two lines :

  file = 'someFile.txt'
  infile = open(file, 'r')

within your view function.  Else the file is only opened when your
view module is imported, not when the view function is called.

Also, beware that if you don't use an absolute path for the file, it
will be looked for in the "current working directory" whatever it is
at that time (warning: the "current working directory" is NOT your
app's or project directory - it can be absolutely any possible
directory on your filesystem).

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



Re: how to create a hidden field

2011-08-02 Thread webcomm
On Aug 2, 4:56 pm, Brian Neal  wrote:
> Oh...you are trying to do this in the *admin*? Are you sure you just
> don't need to "exclude" the form field?

Yep, that's what I needed.  I already had an admin class for the
model, so it was just a matter of adding the line to exclude the
field.

For some reason I thought django would complain if there wasn't a
field (hidden or not) in the form for each of the model class
attributes.  Not sure why I thought that.  Excluding the field is the
way to go.

Thanks

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



HttpRequest.META['SERVER_PORT'] is a string?

2011-08-02 Thread Roy Smith
I'm running django 1.3.  If I access HttpRequest.META['SERVER_PORT'],
I get back a string (i.e. "80").  I was expecting an integer.  Is this
a bug (in which case I'll open a ticket to fix it) or it it
intentional that it's returning a string (in which case I'll open a
ticket to document it better).

-- 
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: Dynamic page refreash

2011-08-02 Thread dirleyrls
I think you should open, count the lines of and close the file inside
the view. The view code is executed once per request. I think that
somethink like this will solve your problems:

def test_results(request):
infile = open('someFile.txt', 'r')
# ... count the lines of the file
infile.close()
return render_to_response('results.html', {'results':f}



On 2 ago, 14:55, lmcadory  wrote:
> Here is my code, minus all the import statements.
>
> file = 'someFile.txt'
> infile = open(file, 'r')
>
> def test_results(request):
>       expectedResults = 10
>       lines = infile.readlines()
>       lineCount = len(lines)
>       if lineCount == expectedResults:
>             p = 'Passed'
>             return render_to_response('results.html', {'results':p}
>       else:
>             f = 'Fail'
>             return render_to_response('results.html', {'results':f}
>
> #HTML
> 
> 
> The test {{ results }}.
> 
> 

-- 
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-02 Thread biofob...@gmail.com
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.



Re: add a field to a form that isn't in a model

2011-08-02 Thread webcomm
I'm not sure that reference is going to answer my question but, in any
case, there appears to be lots of good stuff in there.  My old deskjet
will hate me for printing that page out, but I better try.

-- 
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 create a hidden field

2011-08-02 Thread Brian Neal
On Aug 2, 3:14 pm, webcomm  wrote:
> ...
> Non-interactively, in the automatic admin, what I get is a visible
> text input below the title field and above the summary field.  Here's
> the relevant model and modelform:http://pastebin.com/azKgdraw
>
> -Ryan

Oh...you are trying to do this in the *admin*? Are you sure you just
don't need to "exclude" the form field?

https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.exclude

If you really want the admin to use your custom form you have to tell
it to:

https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form

Best,
BN

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



Constructing / rendering a complex

2011-08-02 Thread Michał Sawicz
Hi all,

I'd like to pick your brainz about how would you approach constructing
and rendering a complex table with headers, row/colspanning cells in a
most clean way that rids the view of rendering as much as possible.

Here's roughly what I'm after (incomplete, but you should see what I
mean):
http://imageshack.us/f/845/zrzutekranuqv.png/

There are three approaches I can think of:

 1. Construct a complete grid in the view, along with row/colspans
that I would simply iterate over and render in the template, but
that would make it virtually impossible to change the
appearance.
 2. Count the cells / rows and compare them with data from the view
to decide on how that particular cell should behave, but that
makes the template a nightmare.
 3. ID all the cells and change the attributes accordingly, but for
rowspanning cells I wouldn't know in the consecutive rows that
there in fact was a cell and I might want to repeat it. Maybe I
could fill in the complete grid but make the ones that get
spanned ignorable in the template through a class.

I'll take all thoughts :)
-- 
Michał (Saviq) Sawicz 


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


Re: in the shell, "module object has no attribute Model"

2011-08-02 Thread webcomm
On Aug 2, 3:38 pm, Daniel Roseman  wrote:
> by declaring that metadata explicitly:
>
>    1. In [2]: class MyTest(models.Model):
>    2.    ...:     title=models.CharField(max_length=200)
>    3.    ...:     class Meta:
>       ...:         app_label = 'my_test'
>

Actually, that seems to have fixed both errors : )

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



Re: how to create a hidden field

2011-08-02 Thread webcomm
> You still haven't shown that it doesn't hide the field, eg by posting
> the output of frm.as_p(), where as I have shown conclusively that it
> does, so I think something else is going on here. Are you sure the
> field 'itemid' exists on your model?

Thanks Tom.  The field itemid does exist in the model.  I am getting a
different result when I use as_p() interactively than what I get non-
interactively.

With the call to as_p I get the desired result, like you did, wherein
the field is hidden:

u'Title: \nSummary: \nBody: \nCategory: \n-\nOld News\nBreaking\n\nAuthor: \nTy Cobb
\nBabe Ruth\nMike
Schmidt\n  Hold down
"Control", or "Command" on a Mac, to select more than one.
\nPath: '

Non-interactively, in the automatic admin, what I get is a visible
text input below the title field and above the summary field.  Here's
the relevant model and modelform: http://pastebin.com/azKgdraw

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



django-pdb on PyPI

2011-08-02 Thread Tom Christie
I've thrown up the django-pdb package on PyPI - hopefully some of y'all will 
find it a useful little tool.

PyPI: http://pypi.python.org/pypi/django-pdb/0.1.1
GitHub: https://github.com/tomchristie/django-pdb

Suggestions and contributions are of course very welcome.


Here's the basic README...

Make debugging Django easier
==

Adding pdb.set_trace() to your source files every time you want to break 
into pdb sucks.

Don't do that.

Do this.

Installation


Install using `pip`, add to your INSTALLED_APPS:
pip install django-pdb

INSTALLED_APPS = (
...
'django_pdb',
)

Usage
=

manage.py runserver
Drops into pdb at the start of a view if the URL includes a 'pdb' GET 
parameter

manage.py runserver --pdb
Drops into pdb at the start of every view

manage.py test --pdb
Drops into pdb on test errors/failures

-- 
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/-/5gg7RyxmnIAJ.
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: add a field to a form that isn't in a model

2011-08-02 Thread Shawn Milochik



I have no template for the form.  I'm using the automatic admin.



Then that's a whole different issue.

https://docs.djangoproject.com/en/1.3/ref/contrib/admin/

Check this out, and read up on how to specify your own form.


--
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: add a field to a form that isn't in a model

2011-08-02 Thread webcomm
On Aug 2, 12:40 pm, Shawn Milochik  wrote:
> You don't need to add the fields to your model. If the extra fields
> don't appear on your page it's probably because you didn't add them to
> the template.

I have no template for the form.  I'm using the automatic admin.

-- 
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: Dynamic page refreash

2011-08-02 Thread lmcadory
I fixed it. I needed to remove --noreload

-- 
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/-/9bDXiW-7insJ.
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-02 Thread Daniel Roseman
On Tuesday, 2 August 2011 19:15:12 UTC+1, voss wrote:
>
> Hello all,
>
> I have a dynamic form as follows:
>
> class myForm(forms.Form):
> Question = 
> forms.ModelMultipleChoiceField(queryset=Model.objects.none(), 
> 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()
>
>
> In views.py I have
>
> def myAnswer(request):
> Answer = myForm(request.GET or None)
> if Answer.is_valid():
> ...
> ...
>
> I am getting the "'QueryDict' object has no attribute 'session'" error, and 
> I believe it is because of the "Ans = myForm(request.GET or None)" line. 
> Could anyone please let me know how to fix it ?
>
> Many thanks!
>
>
You've defined your form to expect a `request` argument, but then you 
haven't passed that argument.

answer = MyForm(request, request.GET or None) 
--
DR.

-- 
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/-/3eYgahTEsy8J.
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: in the shell, "module object has no attribute Model"

2011-08-02 Thread Daniel Roseman
On Tuesday, 2 August 2011 20:14:09 UTC+1, webcomm wrote:
>
> I'm also getting "list index out of range" quite often.  Here is a 
> shell session showing the error in context:  http://pastebin.com/FBE30SDK


I don't know about the 'has no attribute Model', since you don't show the 
traceback for that. I suspect you just haven't imported what you think you 
have.
 

But the 'out of range' error is because Django's expecting model class 
declarations to be inside an app's models.py. It gets certain metadata from 
there automatically. You can fix this by declaring that metadata explicitly:


   1. In [2]: class MyTest(models.Model):
   2....: title=models.CharField(max_length=200)
   3....: class Meta:
  ...: app_label = 'my_test'
   
   --
   DR.
   

-- 
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/-/KtRU4drFk_cJ.
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: in the shell, "module object has no attribute Model"

2011-08-02 Thread webcomm
I'm also getting "list index out of range" quite often.  Here is a
shell session showing the error in context:  http://pastebin.com/FBE30SDK

-- 
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: Tracking RSS feeds usage

2011-08-02 Thread Eric Chamberlain
Have you considered using feedburner?  Google acquired them a few years ago.  I 
think there is integration with Analytics.

--
Eric Chamberlain, Founder
RingFree Mobility Inc.








On Aug 2, 2011, at 3:04 AM, Dealshelve Team wrote:

> I am using 
> https://docs.djangoproject.com/en/dev/ref/contrib/syndication/#a-complex-example
>  for my project.
> 
> Since the feed is essentially presented in XML to user, I have no way to 
> track the access with Google Analytics.
> But I am thinking to register that access by sending Django request object to 
> Google Analytics when I call Feed's items() method.
> 
> Has anyone done this before? Or does it even make sense?
> 
> -- 
> 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: Most stable Linux distribution for Django - Python development

2011-08-02 Thread Shawn Milochik

On 08/02/2011 01:59 PM, highpointe wrote:

Not to hijack the thread but as an additional question...

Is anyone having success with CentOS?

Thanks for letting me interject. :-)



Our production server is on Cent OS and has been up for 742 days without 
a reboot. For whatever that's worth.


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



Django session + dynamic form + model form

2011-08-02 Thread voss
Hello all,

I have a dynamic form as follows:

class myForm(forms.Form):
Question = forms.ModelMultipleChoiceField(queryset=Model.objects.none(), 
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()


In views.py I have

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

I am getting the "'QueryDict' object has no attribute 'session'" error, and 
I believe it is because of the "Ans = myForm(request.GET or None)" line. 
Could anyone please let me know how to fix it ?

Many thanks!

-- 
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/-/Lrlt6JCAaAcJ.
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: Most stable Linux distribution for Django - Python development

2011-08-02 Thread highpointe
Not to hijack the thread but as an additional question...

Is anyone having success with CentOS?

Thanks for letting me interject. :-)


On Aug 2, 2011, at 8:43 AM, Steven Smith  wrote:

> We're using Gentoo 64-bit on all of our production webservers at work,
> and I run 4 additional Gentoo-based Django servers outside of work.
> 
> It took a long time to configure, and is not for the faint of heart.
> 
> But, my stripped-down versions of Apache and Postgres run really fast
> with a small memory footprint. Gentoo provided the framework that made
> these customizations easy (a lot easier to optimize things with USE
> flags than low-level compile options...). Since I don't have a lot of
> the bloat that is plaguing Linux these days, I can do system updates
> infrequently and quickly. The full day it took me to get the server
> set up has more than paid for itself by making long-term maintenance a
> snap.
> 
> 
> 
> 
> On Aug 1, 4:27 am, Anoop Thomas Mathew  wrote:
>> Hi All,
>> Firstly, I am not here for a distro war.
>> 
>> I was using ubuntu 9.10, and then switched to fedora 14 and then to fedora
>> 15.
>> IMHO, It seems that they all were quite unstable. (Many times it hung up on
>> my Dell and HP machines - may be driver issues, still I don't want that
>> too.)
>> I would really like some recommendation for a linux distro which is much
>> stable, but still can support all relevant packages.
>> 
>> Top recommendations I found around was Debian and OpenSuse.
>> Please revert with your suggestions.
>> 
>> Thanks,
>> Anoop Thomas Mathew
>> 
>> atm
>> ___
>> Life is short, Live it hard.
> 
> -- 
> 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.



in the shell, "module object has no attribute Model"

2011-08-02 Thread webcomm
I am trying to get more comfortable with interactive programming in
the shell... which I have always found a bit awkward and have mostly
avoided in favor of working in files (even for small experiments.)

I'm trying to do something pretty simple:

from django.db import models
class News(models.Model):
title=models.CharField(max_length=200)

It's when I hit return a second time, to get out of the indent, that I
get this error: "module object has no attribute Model".   I'm working
in iPython.

Is there an obvious noob mistake I'm making here?  I don't run into
this error when I work in a file.

Thanks for your help,
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.



Re: No module named servers.basehttp

2011-08-02 Thread bob gailer
I ran checkdsk, ensured no remnants of the original install were
around, reinstalled django now it all works.

-- 
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: Unknown command: 'startproject'

2011-08-02 Thread bob gailer
Thank all of you for your responses. I ran checkdsk, ensured no
remnants of the original install were around, reinstalled django now
it all works.

-- 
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 1.3 CreateView/ModelForm and dynamic filtering of fields

2011-08-02 Thread Paul Walsh
can anyone help with this?

thx.

-- 
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/-/oB-B4Y8NHVQJ.
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: Dynamic page refreash

2011-08-02 Thread lmcadory
There should be closing brackets on the ends of the 2
render_to_response statements.

On Aug 2, 1:55 pm, lmcadory  wrote:
> Here is my code, minus all the import statements.
>
> file = 'someFile.txt'
> infile = open(file, 'r')
>
> def test_results(request):
>       expectedResults = 10
>       lines = infile.readlines()
>       lineCount = len(lines)
>       if lineCount == expectedResults:
>             p = 'Passed'
>             return render_to_response('results.html', {'results':p}
>       else:
>             f = 'Fail'
>             return render_to_response('results.html', {'results':f}
>
> #HTML
> 
> 
> The test {{ results }}.
> 
> 

-- 
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: Views / Template - displaying data from other class.

2011-08-02 Thread bruno desthuilliers
First rename your "image_fk" field in Image to "news" - it's a
relation from an image to a news, not from an image to another image,
and the "_fk" prefix is irrelevant.

Then, from a News instance, you'll be ables to access the related
images using younews.image_set.all in the templates, ie:


{% for news in object_list %}
# display the news stuff here
{% for image in news.image_set.all %}
   # display the image here
{% endfor %}
{% endfor %}

Just skip the outer loop for the "single" template.

FWIW, all this is documented, and IIRC there are examples in the
tutorial.

-- 
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: Dynamic page refreash

2011-08-02 Thread lmcadory
Display the results.

On Aug 2, 1:37 pm, bruno desthuilliers 
wrote:
> On 2 août, 19:22, lmcadory  wrote:
>
> > I'm having this problem, my web design knowledge is limited and I'm
> > having a hard time searching for the solution (if there is one)
>
> > The problem is this:
>
> > I have a view that counts the number of lines in a file. It then
> > pushes that result to an html page.
>
> Uh ? What does that mean exactly ? (the "pushes that result to an html
> page" part)
>
> > What I want it to do is when that
> > line count changes when I press the refresh button on the browser it
> > displays the new number. Right now I have to reload the server to
> > display the results.
>
> You shouldn't, so chances are you did something wrong (like putting
> the code that computes the lines count at the module top-level or
> something alike), but it's hard to tell exactly without looking at
> your code.
>
>
>
> > I, if I'm asking the question correctly, is there a way I can tell the
> > view to run again and republish the results?
>
> The view function is called each time you reload the corresponding
> url.

-- 
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: Dynamic page refreash

2011-08-02 Thread lmcadory
Here is my code, minus all the import statements.

file = 'someFile.txt'
infile = open(file, 'r')

def test_results(request):
  expectedResults = 10
  lines = infile.readlines()
  lineCount = len(lines)
  if lineCount == expectedResults:
p = 'Passed'
return render_to_response('results.html', {'results':p}
  else:
f = 'Fail'
return render_to_response('results.html', {'results':f}



#HTML


The test {{ results }}.



-- 
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-02 Thread bruno desthuilliers
On 2 août, 18:21, "biofob...@gmail.com"  wrote:
> I am a designer guy not a programmer. My coding skills are html, css
> and some jquery tweaks to suit my needs, but i come to a point where i
> think i need to learn a real language. What i'm doing now is working
> with Textpattern or Wordpress(but i dont really like it) when i need
> some dynamic web site. So my question is: is Django viable for me or
> is to overwhelming. Should I stick to my current situation and be and
> average cms "tweaker" or learn a new language to boost my toolbox? I
> asked this same question on another forum and 90% of the replies where
> to learn PHP and work with wordpress ( but the code ). Also i
> don't know where to begin with django apart from the installation of
> course. Is there any tutorials about using django for web design?
> Thanks in advance

Django is not about web "design" but about server-side web programming
- just like PHP is FWIW, and you'll have to learn programming if you
expect to do anything right with either. PHP is probably easier to get
started with, but the way it works tends to promote messy code and bad
practices - and FWIW, as a language, it's a mess by itself. Python is
a more powerful and cleaner language, and Django is a sane, no-
nonsense framework, but it assumes you already have some basic
programming knowledge.

To make a long story short: you'll have to learn programming anyway,
so you might be better learning with a sane language and framewok -
but my opinion is obviously biased ;)


> P.S- I work on OSX don't know if its relevant or not.

As far as I'm concerned, OSX is a pain (as a programming platform)
whaver language / techno you want to use.

-- 
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-02 Thread webcomm
Hi there,

For building dynamic websites, I'd say you should learn a language
like PHP or Python.  Yep.  For working with Django you definitely need
to know Python.

Something like WordPress has a very different and narrower set of
intentions behind its design than does Django.  WordPress is really a
blogging program, though some people bend it to other purposes.
Django is a framework, through and through, so it is designed for more
diverse purposes.

Where to learn Django:  djangoproject.org tutorials and the Definitive
Django Guide:  http://www.djangobook.com/

As for PHP vs Python... neither programming language is harder or
easier to learn.  However, I would say learning Python + Django ends
up being harder overall because it requires more understanding of
server administration than PHP requires.  I like Python a little
better than PHP, and Django is great, but getting started with the PHP
language + a PHP framework is easier and requires less learning
overall.  Some would say "well, don't you want to learn more, not
less?"  That depends on your situation.

Oh, and to get a site up and running, yeah, it would be much easier to
learn PHP + WordPress, or PHP + symfony, etc.

Good luck,
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.



Re: Django for a front end designer

2011-08-02 Thread Cal Leeming [Simplicity Media Ltd]
On Tue, Aug 2, 2011 at 6:44 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Difficult to say really.
>
> If your main focus is to be a designer, and not to be a full on programmer,
> then I'd say you are probably best sticking with wordpress.
>
> If you don't really have a main focus, or you have some spare time, then
> defo take some time to learn python+django. I would strongly advice learning
> some Python first, then moving onto Django afterwards, it will help a lot.
>
> From my own experience, I come from a background of 8 years PHP/Python
> development, and 2 years of Django development. It took me around a year,
> and 3 'failed projects' to really learn how to use Django properly. It's all
> a learning curve :)
>

+ I'm still learning new things about Python+Django every day lol.


>
> Hope this helps
>
> Cal
>
> On Tue, Aug 2, 2011 at 5:21 PM, biofob...@gmail.com 
> wrote:
>
>> I am a designer guy not a programmer. My coding skills are html, css
>> and some jquery tweaks to suit my needs, but i come to a point where i
>> think i need to learn a real language. What i'm doing now is working
>> with Textpattern or Wordpress(but i dont really like it) when i need
>> some dynamic web site. So my question is: is Django viable for me or
>> is to overwhelming. Should I stick to my current situation and be and
>> average cms "tweaker" or learn a new language to boost my toolbox? I
>> asked this same question on another forum and 90% of the replies where
>> to learn PHP and work with wordpress ( but the code ). Also i
>> don't know where to begin with django apart from the installation of
>> course. Is there any tutorials about using django for web design?
>> Thanks in advance
>>
>> P.S- I work on OSX don't know if its relevant or not.
>>
>> --
>> 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-02 Thread Cal Leeming [Simplicity Media Ltd]
Difficult to say really.

If your main focus is to be a designer, and not to be a full on programmer,
then I'd say you are probably best sticking with wordpress.

If you don't really have a main focus, or you have some spare time, then
defo take some time to learn python+django. I would strongly advice learning
some Python first, then moving onto Django afterwards, it will help a lot.

>From my own experience, I come from a background of 8 years PHP/Python
development, and 2 years of Django development. It took me around a year,
and 3 'failed projects' to really learn how to use Django properly. It's all
a learning curve :)

Hope this helps

Cal

On Tue, Aug 2, 2011 at 5:21 PM, biofob...@gmail.com wrote:

> I am a designer guy not a programmer. My coding skills are html, css
> and some jquery tweaks to suit my needs, but i come to a point where i
> think i need to learn a real language. What i'm doing now is working
> with Textpattern or Wordpress(but i dont really like it) when i need
> some dynamic web site. So my question is: is Django viable for me or
> is to overwhelming. Should I stick to my current situation and be and
> average cms "tweaker" or learn a new language to boost my toolbox? I
> asked this same question on another forum and 90% of the replies where
> to learn PHP and work with wordpress ( but the code ). Also i
> don't know where to begin with django apart from the installation of
> course. Is there any tutorials about using django for web design?
> Thanks in advance
>
> P.S- I work on OSX don't know if its relevant or not.
>
> --
> 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-02 Thread Shawn Milochik
Go for it. It will require you to learn to program, but if you're up for 
it then that's awesome.


If you do the tutorial and read the following wiki page I'm sure you'll 
find plenty of helpful people on this list.

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.



Re: Dynamic page refreash

2011-08-02 Thread bruno desthuilliers
On 2 août, 19:22, lmcadory  wrote:
> I'm having this problem, my web design knowledge is limited and I'm
> having a hard time searching for the solution (if there is one)
>
> The problem is this:
>
> I have a view that counts the number of lines in a file. It then
> pushes that result to an html page.

Uh ? What does that mean exactly ? (the "pushes that result to an html
page" part)

> What I want it to do is when that
> line count changes when I press the refresh button on the browser it
> displays the new number. Right now I have to reload the server to
> display the results.

You shouldn't, so chances are you did something wrong (like putting
the code that computes the lines count at the module top-level or
something alike), but it's hard to tell exactly without looking at
your code.

>
> I, if I'm asking the question correctly, is there a way I can tell the
> view to run again and republish the results?

The view function is called each time you reload the corresponding
url.

-- 
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: using the request object inside a form

2011-08-02 Thread vanderkerkoff
Thanks Daniel

I told you I was doing something stupid :-)

V

On Aug 2, 5:22 pm, Daniel Roseman  wrote:
> The problem isn't in the code you've posted, but in how you instantiate the 
> form in your view. You need to actually pass in 'request' as a keyword 
> argument.
> --
> DR.

-- 
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 display Scientific Notation for a field on the admin pages?

2011-08-02 Thread DjangoOfWar
Right now I have a Decimal field in my model but I'd like it to
display as scientific notation on the admin pages.

Do I need to make a custom model field, that uses a custom form field
or is there an easier way?

(I'm on Django 1.2 if it matters)

-- 
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 + PyPy = ?

2011-08-02 Thread Bill Freeman
See if there is a .pth file somehow made pypy specific in
/home/wsgi/pypy-1.5/site-packages or /home/wsgi/pypy-1.5 that mentions
the PIL package but nothing else.

On Tue, Aug 2, 2011 at 1:19 PM, Dmitry Pisklov  wrote:
> Well...
>
> $ /home/wsgi/pypy-1.5/bin/pypy
> Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
> [PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> And now for something completely different: ``yes, but what't the sense of 0
> <
> "duran duran"''
> import sys,pprint
> pprint.pprint(sys.path)
> ['',
>  '/home/wsgi/pypy-1.5/lib_pypy',
>  '/home/wsgi/pypy-1.5/lib-python/modified-2.7',
>  '/home/wsgi/pypy-1.5/lib-python/2.7',
>  '/home/wsgi/pypy-1.5/lib-python/modified-2.7/lib-tk',
>  '/home/wsgi/pypy-1.5/lib-python/2.7/lib-tk',
>  '/home/wsgi/pypy-1.5/lib-python/2.7/plat-linux2',
>  '/home/wsgi/pypy-1.5/site-packages',
>  '/home/wsgi/pypy-1.5/site-packages/PIL']
>
>
> So you're right, it sees only dirs inside its installation dir. But funny
> thing is that directory /home/wsgi/pypy-1.5/site-packages is actually
> symlink:
>
> /home/wsgi/pypy-1.5/site-packages -> /usr/share/pyshared/
>
> and it points to the python's site-packages. And that PIL (last entry)
> exists in the target directory. So I wonder why on earth it sees only PIL
> subdir, from helluva lot of others? Even if I set path manually:
>
> $ export PYTHONPATH=/usr/share/pyshared
> $ /home/wsgi/pypy-1.5/bin/pypy
> Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
> [PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> And now for something completely different: ``to save a tree, eat a beaver''
> import pprint, sys
> pprint.pprint(sys.path)
> ['',
>  '/usr/share/pyshared',
>  '/home/wsgi/pypy-1.5/lib_pypy',
>  '/home/wsgi/pypy-1.5/lib-python/modified-2.7',
>  '/home/wsgi/pypy-1.5/lib-python/2.7',
>  '/home/wsgi/pypy-1.5/lib-python/modified-2.7/lib-tk',
>  '/home/wsgi/pypy-1.5/lib-python/2.7/lib-tk',
>  '/home/wsgi/pypy-1.5/lib-python/2.7/plat-linux2',
>  '/home/wsgi/pypy-1.5/site-packages',
>  '/home/wsgi/pypy-1.5/site-packages/PIL']
>
>
> The same error after that:
>
> $ /home/wsgi/pypy-1.5/bin/pypy manage.py shell
>
> Traceback (most recent call last):
>   File "app_main.py", line 53, in run_toplevel
>   File "manage.py", line 2, in 
>     from django.core.management import execute_manager
> ImportError: No module named django.core
>
> So I think I'll give up at this point - I now realized that my interest in
> pypy come probably too early...
>
> --
> 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/-/JkpNIjkA3qYJ.
> 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.



Dynamic page refreash

2011-08-02 Thread lmcadory
I'm having this problem, my web design knowledge is limited and I'm
having a hard time searching for the solution (if there is one)

The problem is this:

I have a view that counts the number of lines in a file. It then
pushes that result to an html page. What I want it to do is when that
line count changes when I press the refresh button on the browser it
displays the new number. Right now I have to reload the server to
display the results.

I, if I'm asking the question correctly, is there a way I can tell the
view to run again and republish the results?

-- 
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 + PyPy = ?

2011-08-02 Thread Dmitry Pisklov
Well...

$ /home/wsgi/pypy-1.5/bin/pypy
Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
[PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``yes, but what't the sense of 0 
<
"duran duran"''
 import sys,pprint
 pprint.pprint(sys.path)
['',
 '/home/wsgi/pypy-1.5/lib_pypy',
 '/home/wsgi/pypy-1.5/lib-python/modified-2.7',
 '/home/wsgi/pypy-1.5/lib-python/2.7',
 '/home/wsgi/pypy-1.5/lib-python/modified-2.7/lib-tk',
 '/home/wsgi/pypy-1.5/lib-python/2.7/lib-tk',
 '/home/wsgi/pypy-1.5/lib-python/2.7/plat-linux2',
 '/home/wsgi/pypy-1.5/site-packages',
 '/home/wsgi/pypy-1.5/site-packages/PIL']



So you're right, it sees only dirs inside its installation dir. But funny 
thing is that directory /home/wsgi/pypy-1.5/site-packages is actually 
symlink:

/home/wsgi/pypy-1.5/site-packages -> /usr/share/pyshared/

and it points to the python's site-packages. And that PIL (last entry) 
exists in the target directory. So I wonder why on earth it sees only PIL 
subdir, from helluva lot of others? Even if I set path manually:

$ export PYTHONPATH=/usr/share/pyshared
$ /home/wsgi/pypy-1.5/bin/pypy
Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
[PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``to save a tree, eat a beaver''
 import pprint, sys
 pprint.pprint(sys.path)
['',
 '/usr/share/pyshared',
 '/home/wsgi/pypy-1.5/lib_pypy',
 '/home/wsgi/pypy-1.5/lib-python/modified-2.7',
 '/home/wsgi/pypy-1.5/lib-python/2.7',
 '/home/wsgi/pypy-1.5/lib-python/modified-2.7/lib-tk',
 '/home/wsgi/pypy-1.5/lib-python/2.7/lib-tk',
 '/home/wsgi/pypy-1.5/lib-python/2.7/plat-linux2',
 '/home/wsgi/pypy-1.5/site-packages',
 '/home/wsgi/pypy-1.5/site-packages/PIL']



The same error after that:

$ /home/wsgi/pypy-1.5/bin/pypy manage.py shell
 
Traceback (most recent call last):
  File "app_main.py", line 53, in run_toplevel
  File "manage.py", line 2, in 
from django.core.management import execute_manager
ImportError: No module named django.core



So I think I'll give up at this point - I now realized that my interest in 
pypy come probably too early... 

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



Django for a front end designer

2011-08-02 Thread biofob...@gmail.com
I am a designer guy not a programmer. My coding skills are html, css
and some jquery tweaks to suit my needs, but i come to a point where i
think i need to learn a real language. What i'm doing now is working
with Textpattern or Wordpress(but i dont really like it) when i need
some dynamic web site. So my question is: is Django viable for me or
is to overwhelming. Should I stick to my current situation and be and
average cms "tweaker" or learn a new language to boost my toolbox? I
asked this same question on another forum and 90% of the replies where
to learn PHP and work with wordpress ( but the code ). Also i
don't know where to begin with django apart from the installation of
course. Is there any tutorials about using django for web design?
Thanks in advance

P.S- I work on OSX don't know if its relevant or not.

-- 
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-02 Thread George Cummins
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)
> > 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 ).
> > I have checked and rechecked the code, and can find no problems. Can you
> > tell me the differences in the way Django handles imports when debugging
> is
> > on or off, or point to relevant documentation?
> > Thank you,
> > George Cummins
> >
>
>
> Django doesn't do anything differently, AFAIK (happy to be corrected).
>
> However, this doesn't necessarily mean that there cannot be a
> difference. For instance, if prep/games/models.py started like this:
>
> from django.conf import settings
> if not settings.DEBUG:
>  from django import no_such_module
>
> then attempting to import a model from that file would fail if
> settings.DEBUG is off. Obviously this is a contrived example, but
> could something like this be affecting you?
>
> Cheers
>
> Tom
>
>
>
Thank you for the tip. I have verified that no custom code is executing
based on the debug state.

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.

Any other ideas would be greatly 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.



Re: add a field to a form that isn't in a model

2011-08-02 Thread Shawn Milochik
You don't need to add the fields to your model. If the extra fields 
don't appear on your page it's probably because you didn't add them to 
the template.


I'm assuming you're using something like form.as_p, which probably 
doesn't pick up the extra fields.


--
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-02 Thread Tom Evans
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)
> 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 ).
> I have checked and rechecked the code, and can find no problems. Can you
> tell me the differences in the way Django handles imports when debugging is
> on or off, or point to relevant documentation?
> Thank you,
> George Cummins
>


Django doesn't do anything differently, AFAIK (happy to be corrected).

However, this doesn't necessarily mean that there cannot be a
difference. For instance, if prep/games/models.py started like this:

from django.conf import settings
if not settings.DEBUG:
  from django import no_such_module

then attempting to import a model from that file would fail if
settings.DEBUG is off. Obviously this is a contrived example, but
could something like this be affecting you?

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: add a field to a form that isn't in a model

2011-08-02 Thread webcomm
On Aug 2, 11:16 am, Shawn Milochik  wrote:
> Just add the fields to your ModelForm and then do whatever you want in
> your save() override.

Thanks for your reply, Shawn.  Adding the fields in my ModelForm
doesn't seem to do the trick, by itself.  The field doesn't appear in
the form unless I also add it to the model class, which necessitates
that I have a table field for the above mentioned model class X.  The
upshot is that I would end up storing the same data in two different
tables.  In my present case, that's no big problem, so perhaps I
shouldn't worry about it.  But, just out of curiosity, I wonder what I
would do if I felt it was imperative to not store the data in two
different tables.

-- 
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: static files (development server)

2011-08-02 Thread veva...@yandex.ru
Tom,
I added
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
and
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
to urlconf, but didn't get any result.

Vladimir

-- 
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: Help please xml2-config from libxml2

2011-08-02 Thread Carlos Daniel Ruvalcaba Valenzuela
Hello, your problem is most probably the lack of the development package for
libxml2, try installing the libxml2-dev package via apt-get command or
synaptic under Ubuntu.

Regards,
Carlos Ruvalcaba
El 02/08/2011 15:39, "theseventhletter"  escribió:
> Good Day to all
> i been trying to install geodjango but always gets stuck up with this
> error after i downloaded postGIS and typed ./configure on the
> terminal.
>
> configure: error: could not find xml2-config from libxml2 within the
> current path. You may need to try re-running configure with a --with-
> xml2config parameter.
>
>
> ive used google to search for answer to this error but i haven't found
> anything to fix this
>
> im using ubuntu 11.04 in a VM (oracle)
>
> thanks
>
> --
> 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: how to create a hidden field

2011-08-02 Thread Tom Evans
On Tue, Aug 2, 2011 at 3:47 PM, webcomm  wrote:
>> Have you simplified your example?
>
> The example I provided in the original post is the actual code in my
> models.py.  It's not simplified.
>
>> >>> class TestForm(ModelForm):
>>
>> ...   range = CharField(widget=HiddenInput)
>> ...   class Meta:
>> ...     model=Foo
>> ...>>> f=TestForm()
>> >>> f.as_p()
>>
>> u'Name: > id="id_name" />'
>>
>> As you can see, the range field is clearly hidden.
>
> I get "CharField is not defined" when I try your code.  I find that I
> have to do forms.SomeField.  Maybe we're importing different things.
> In my models.py I have...
>
> from django.db import models
> from django import forms
> from django.forms import ModelForm
>
> I'm using django 1.3.
>
> -Ryan
>

Well, in the console I cannot be arsed to continually type
forms.SomeThing, so I imported * from django.forms, but this is
largely irrelevant.

You still haven't shown that it doesn't hide the field, eg by posting
the output of frm.as_p(), where as I have shown conclusively that it
does, so I think something else is going on here. Are you sure the
field 'itemid' exists on your model?

This is speculation, but I think you don't have a field called itemid
on your model, and so are creating an additional field called itemid,
which is hidden. You display the form, you don't see the new, hidden,
'itemid' field because it is hidden, but you do see your field which
is not called 'itemid', and you then think that the field is not
hidden.

It's not hard to test this, go to your django console, import the
form, instantiate it and call the as_p method. Do you have a hidden
field called 'itemid' or not?

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.



using the request object inside a form

2011-08-02 Thread Daniel Roseman
The problem isn't in the code you've posted, but in how you instantiate the 
form in your view. You need to actually pass in 'request' as a keyword 
argument. 
-- 
DR. 

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



Views / Template - displaying data from other class.

2011-08-02 Thread Petey
Hi.

I want to display images for news. Images class is a seperate model.

In generic view (index) to display news and images I use 2 "for" loops which 
work.

In "single" view I use get_object_or_404 which changes a bit the template - 
it does not require the loops to display the text.
If I understand it correctly I can't import data from other models for 
certain model without proper loop?

How shoud I modify the "single" view and "single" template to make it 
display images from images class?

http://pastebin.com/k6uzUktq

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



Running test cases on pydev raises an exception due to a problem in the standard library

2011-08-02 Thread Ger
Hi all, I have a django app that works correctly from the console, but
if I try to pass the tests cases from Eclipse+PyDev I got the
following exception:

Traceback (most recent call last):
  File "C:\Users\gfuentes\workspace\AG\src\cfx\manage.py", line 19, in

execute_manager(settings)
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\core\management\__init__.py", line 438, in
execute_manager
utility.execute()
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\core\management\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\core\management\base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\core\management\base.py", line 220, in execute
output = self.handle(*args, **options)
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\core\management\commands\test.py", line 19, in handle
from django.test.utils import get_runner
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\test\__init__.py", line 6, in 
from django.test.testcases import TestCase, TransactionTestCase,
skipIfDBFeature, skipUnlessDBFeature
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\test\testcases.py", line 14, in 
from django.test import _doctest as doctest
  File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3-
py2.5.egg\django\test\_doctest.py", line 104, in 
import unittest, difflib, pdb, tempfile
  File "C:\sw\Python25\lib\pdb.py", line 53, in 
class Pdb(bdb.Bdb, cmd.Cmd):
AttributeError: 'module' object has no attribute 'Cmd'

The django version is: 1.3
Python version: 2.5

I already checked on the Internet but without success. When I run it
from the console I use the same python installation

Do you have any ideas?
Thank you from advanced

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



Help please xml2-config from libxml2

2011-08-02 Thread theseventhletter
Good Day to all
i been trying to install geodjango but always gets stuck up with this
error after i downloaded postGIS and typed ./configure on the
terminal.

configure: error: could not find xml2-config from libxml2 within the
current path. You may need to try re-running configure with a --with-
xml2config parameter.


ive used google to search for answer to this error but i haven't found
anything to fix this

im using ubuntu 11.04 in a VM (oracle)

thanks

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



Django raises IOerror in csrf.py middleware

2011-08-02 Thread Thomas Orozco
Hello,

I received a traceback from Django and I'm unable to figure out where the
error comes from.
The form is a basic picture upload form, I've read that this kind of errors
do happen when the connection is broken before all data was sent, but here,
the crash occured in csrf.py, which it was not in other error reports that I
read.

So here's my traceback and my Middleware config, if someone has seen this,
please tell me (and hopefully explain : D), because I'm kinda running out of
ideas (and so far, I've been unable to recreate the error).

Thanks in advance !

Middleware:

MIDDLEWARE_CLASSES = (
'middleware.loc.ForceDefaultLanguageMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django_mobile.middleware.MobileDetectionMiddleware',
'django_mobile.middleware.SetFlavourMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'middleware.technical.UserBasedExceptionMiddleware',
)


Traceback:

Traceback (most recent call last):
  File
"/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line
105, in get_response
response = middleware_method(request, callback, callback_args,
callback_kwargs)

  File "/usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py",
line 200, in process_view
request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')

  File
"/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line
210, in _get_post
self._load_post_and_files()

  File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py",
line 272, in _load_post_and_files
self._post, self._files = self.parse_file_upload(self.META, self)

  File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py",
line 234, in parse_file_upload
return parser.parse()

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 192, in parse
for chunk in field_stream:

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 314, in next
output = self._producer.next()

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 468, in next
for bytes in stream:

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 314, in next
output = self._producer.next()

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 375, in next
data = self.flo.read(self.chunk_size)

  File
"/usr/local/lib/python2.6/dist-packages/django/http/multipartparser.py",
line 405, in read
return self._file.read(num_bytes)

  File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py",
line 296, in read
return self._stream.read(*args, **kwargs)

IOError: request data read error


,
*POST:,*
COOKIES:{'__utma':
'104694172.1806779657.1312296229.1312296229.1312296229.1',
 '__utmb': '104694172.2.10.1312296229',
 '__utmc': '104694172',
 '__utmz':
'104694172.1312296229.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
 'sessionid': 'MySession'},
META:{'CONTENT_LENGTH': '1789914',
 'CONTENT_TYPE': 'multipart/form-data;
boundary=WebKitFormBoundaryU0XxylAHGDwkWtTB',
 'CSRF_COOKIE': 'MyCookie',
 'DOCUMENT_ROOT': '/var/www',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTPS': '1',
 'HTTP_ACCEPT':
'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'sessionid=MySession; csrftoken=MyCSRF;
__utmz=104694172.1312296229.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
__utmc=104694172; __utmb=104694172.2.10.1312296229;
__utma=104694172.1806779657.1312296229.1312296229.1312296229.1',
 'HTTP_HOST': 'www.MySite.com',
 'HTTP_ORIGIN': 'www.MySite.com',
 'HTTP_REFERER': 'www.MySite.com/MyForm',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8;
fr-fr) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5
Safari/533.21.1',
 'PATH_INFO': u'/user/photo',
 'PATH_TRANSLATED': '/var/www/user/photo',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '2.1.94.60',
 'REMOTE_PORT': '55900',
 'REQUEST_METHOD': 'POST',
 'REQUEST_URI': '/MyApp/user/photo',
 'SCRIPT_FILENAME': '/usr/local/MyApp/apache/django.wsgi',
 'SCRIPT_NAME': u'/MyApp',
 'SERVER_ADDR': 'MyIP',
 'SERVER_ADMIN': 'hostmas...@mysite.com',
 'SERVER_NAME': 'www.MySite.com',
 'SERVER_PORT': '443',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': 'Apache/2.2.14 (Ubuntu) Server at www.MySite.com
Port 443\n',
 'SERVER_SOFTWARE': 'Apache/2.2.14 (Ubuntu)',
 'SSL_TLS_SNI': 'www.MySite.com',
 'mod_wsgi.application_group': 'www.MySite.com|/MyApp',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.handler_script': '',
 'mod_wsgi.input_chunked': '0',
 'mod_wsgi.listener_host': '',
 'mod_wsgi

Re: add a field to a form that isn't in a model

2011-08-02 Thread Shawn Milochik
Just add the fields to your ModelForm and then do whatever you want in 
your save() override.


The example you found has extra code the author added to the model, but 
there's nothing "standard" there. It's just something that suited that 
use-case.


Remember that all of Django is "just" Python, so there's no special way 
you have to do 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.



add a field to a form that isn't in a model

2011-08-02 Thread webcomm
Hi all,

How to add a field to a form that is not a model field?

I want my form for model class X to have a field whose value I will
save to another model class (by overriding the the save method in
model class X).

I think my answer is here...

http://www.hindsightlabs.com/blog/2010/02/11/adding-extra-fields-to-a-model-form-in-djangos-admin/

...but I'm wondering if there is official documentation for those _get
and _set methods.  I don't recall seeing those in the docs and not
sure what is the proper terminology is, in django, to refer to those
methods.

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



using the request object inside a form

2011-08-02 Thread vanderkerkoff
Hello there.

I need to use parts of the URL to calculate some thing inside my form.

Here's a stripped down version, I can't seem to get it to give me
anything other than none for self.request :-(

class EventBookForm(ModelForm):
title = CharField()
firstname = CharField()
surname = CharField()
address = CharField(widget=Textarea(attrs={'rows': 5, 'cols': 80}))
postcode = CharField()
telephone = CharField()
email = EmailField()
workshops = MultipleChoiceField()
requirements = CharField(widget=Textarea(attrs={'rows': 5, 'cols':
80}))

class Meta:
model = Event

def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
print self.request
super(EventBookForm, self).__init__(*args, **kwargs)
workshop_choices = []
data = Workshop.objects.filter("some rules based on what I get 
back
from the request object, which is currently none")
for d in data:
workshop_choices.append((d.title,d.title))

self.fields['workshops']=MultipleChoiceField(widget=CheckboxSelectMultiple,
choices=workshop_choices, required=False)

I'm pretty certain I'm doing something unbelievably stupid but I am
trying, honestly!

Anyone got any ideas?

-- 
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 create a hidden field

2011-08-02 Thread webcomm
> Have you simplified your example?

The example I provided in the original post is the actual code in my
models.py.  It's not simplified.

> >>> class TestForm(ModelForm):
>
> ...   range = CharField(widget=HiddenInput)
> ...   class Meta:
> ...     model=Foo
> ...>>> f=TestForm()
> >>> f.as_p()
>
> u'Name:  id="id_name" />'
>
> As you can see, the range field is clearly hidden.

I get "CharField is not defined" when I try your code.  I find that I
have to do forms.SomeField.  Maybe we're importing different things.
In my models.py I have...

from django.db import models
from django import forms
from django.forms import ModelForm

I'm using django 1.3.

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



Re: Most stable Linux distribution for Django - Python development

2011-08-02 Thread Steven Smith
We're using Gentoo 64-bit on all of our production webservers at work,
and I run 4 additional Gentoo-based Django servers outside of work.

It took a long time to configure, and is not for the faint of heart.

But, my stripped-down versions of Apache and Postgres run really fast
with a small memory footprint. Gentoo provided the framework that made
these customizations easy (a lot easier to optimize things with USE
flags than low-level compile options...). Since I don't have a lot of
the bloat that is plaguing Linux these days, I can do system updates
infrequently and quickly. The full day it took me to get the server
set up has more than paid for itself by making long-term maintenance a
snap.




On Aug 1, 4:27 am, Anoop Thomas Mathew  wrote:
> Hi All,
> Firstly, I am not here for a distro war.
>
> I was using ubuntu 9.10, and then switched to fedora 14 and then to fedora
> 15.
> IMHO, It seems that they all were quite unstable. (Many times it hung up on
> my Dell and HP machines - may be driver issues, still I don't want that
> too.)
> I would really like some recommendation for a linux distro which is much
> stable, but still can support all relevant packages.
>
> Top recommendations I found around was Debian and OpenSuse.
> Please revert with your suggestions.
>
> Thanks,
> Anoop Thomas Mathew
>
> atm
> ___
> Life is short, Live it hard.

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



Django docs and GSoC doc summit

2011-08-02 Thread eset
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 :)

It will be a great summit and focuses on developing concrete outcomes
(books) and an unconference to get people talking about free
documentation of free software. A great way to meet people in the free
doc sector and to attract new comers to your doc team :)

adam





This is a call for proposals for the 2011 Google Summer of Code Doc
Camp. Individuals and projects are invited to submit proposals for the
GSoC Doc Camp to be held at Google's Mountain View headquarters
(California) 17 October - 21 October.

The GSoC Doc Camp is a place for documentors to meet, work on
documentation and share their documentation experiences. The camp aims
to improve free documentation materials and skills in GSoC projects
and individuals and help form the identity of the emergent free
documentation sector.

The Doc Camp will consist of 2 major components - an unconference and
3-5 short form Book Sprints to produce 'Quick Start' guides for
specific GSoC projects.

The unconference will explore topics proposed by the participants. Any
topic on free documentation of free software can be proposed for
discussion during the event.

Each Quick Start Sprint will bring together 5-8 individuals to produce
a book on a specific GSoC project. All participants of the Doc Camp
must attend a sprint. The Quick Start books will be launched at the
opening party for the GSoC Mentors summit immediately following the
event.

Individuals with a passion for free documentation about free software
may apply to attend by filling out the application form  and submitting
before 5 August, 2011. Those wishing to attend do not need to be from
a GSoC project. Accommodation and food will be covered by the GSoC Doc
Camp. Part or complete travel costs can also be applied for as part of
the application process.

Quick Start Sprint projects will be chosen from proposals submitted to
the GSoC Doc Camp before 5 August, 2011 through the application form
.
Applications for Quick Start Sprints are invited from projects that
are part of the 2011 GSoC program. Quick Start Sprint proposals can
nominate up to 5 individuals to attend and participate in the proposed
sprint. A Quick Sprint proposal does not have to nominate individuals
to participate - you can also use this as an opportunity to promote
your project to Doc Camp participants. If the proposal is accepted the
accommodation and food costs will be covered by the Doc Camp for any
listed individuals and part or complete travel costs for each can be
applied for (if applicable).

The GSoC Doc Camp is co-organised by GSoC and FLOSS Manuals. Books
Sprints and unconference facilitation conducted by Adam Hyde.

If you have questions, please contact Carol Smith at car...@google.com
and/or Adam Hyde at a...@flossmanuals.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.



ImportError only when Debug=False

2011-08-02 Thread George Cummins
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)

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

I have checked and rechecked the code, and can find no problems. Can you
tell me the differences in the way Django handles imports when debugging is
on or off, or point to relevant documentation?

Thank you,
George Cummins

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



.css files of the admin pages

2011-08-02 Thread Sheogora
I would like to know how to make changes to the built in style sheets
in the admin pages
I went into this directory where i found images being used in the
admin website
Django-1.3\django\contrib\admin\media\img\admin

and changed images
but it didn't effect my project at all. Is that the wrong place?
Re running the project didn't 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: Django can't see my static files

2011-08-02 Thread lokesh
Try this way which works well.
create folder static_media in project.
In urls.py give below  url
(r'^static_media/(?P.*)','django.views.static.serve',
{'document_root':'static_media'}),
in settings give,
MEDIA_URL = '/static_media/'
it should work.

On Aug 1, 6:17 am, Gchorn  wrote:
> Hello All,
>
> I'm using Django to develop a website, and I'm having trouble getting
> it to see my static files.  I've looked through Django's static file
> documentation and the steps I've taken to get Django to see my files
> (using a CSS file as an example) are as follows:
>
> First, I created a folder called "static" inside the main app folder
> for this project.  Then, I added "/static/" to the STATIC_URLS section
> of the settings.py file, and I also added the full path to my CSS file
> under the STATICFILES_DIRS section of settings.py.
>
> Then I added the line:
>
> from django.template import RequestContext, loader
>
> As well as "context_instance= RequestContext(request)" as a third
> argument to the "return render_to_response()" call.
>
> Finally, in my url.py file, I added this line at the top:
>
> from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>
> And this line at the bottom (separate from the initial "urlpatterns =
> patterns()" call):
>
> urlpatterns += staticfiles_urlpatterns()
>
> In my HTML/Django template, I added the following link to my CSS file:
>
> 
>
> But then after all of this, when I perform a "python manage.py
> runserver" to preview the website, Django still does not appear to
> find the external CSS file.  I must still be missing something but I'm
> not sure what--does anyone know???
>
> I'm sure I'm missing something very basic but I'm a total beginner so
> please be patient with me, I probably need a lot of very specific
> instructions...
>
> thanks,
> Guillaume

-- 
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 create a hidden field

2011-08-02 Thread Tom Evans
On Tue, Aug 2, 2011 at 2:37 PM, webcomm  wrote:
>> That would hide the field called 'itemid' from the model 'News'. Are
>> you saying it doesn't?
>
> That's right.  It's not working.  The field isn't hidden.
>

Have you simplified your example? This functionality works well when
used correctly:

>>> class TestForm(ModelForm):
...   range = CharField(widget=HiddenInput)
...   class Meta:
... model=Foo
...
>>> f=TestForm()
>>> f.as_p()
u'Name: '

As you can see, the range field is clearly hidden.

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 create a hidden field

2011-08-02 Thread webcomm
> That would hide the field called 'itemid' from the model 'News'. Are
> you saying it doesn't?

That's right.  It's not working.  The field isn't hidden.

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



admin - delete_selected problem

2011-08-02 Thread galgal


In admin.py file i paste:admin.site.disable_action('delete_selected')



And get an error:


KeyError at /

'delete_selected'

Django Version: 1.3 Exception Type: KeyError Exception Value:

'delete_selected'

Exception Location: 
c:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\contrib\admin\sites.py
 
in disable_action, line 127

Any idea why it occurs? In my previous websites I haven't that error and it 
is strange for 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/-/tduJes9etMUJ.
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: Extending the User form

2011-08-02 Thread Sheogora
please see this discussion
http://groups.google.com/group/django-users/browse_thread/thread/143942b9002c1468/c4fbf04d75471fbf?lnk=gst&q=Shegoroa#c4fbf04d75471fbf
I made two by accident and marked this for removing, but they didn't
for some reason.
I updated it with a new post, which should show up soon.

-- 
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: Extending new User form

2011-08-02 Thread Sheogora
On Jul 28, 4:27 pm, Derek  wrote:
> On Jul 28, 10:31 am,Shegoroa wrote:
>
> > I am having difficulty figuring out how to make an admin when creating
> > a new user to have an extra field specifying users location.
>
> > I found lots of information on how to extend the user profile and i
> > did so
> > (source of 
> > information)http://stackoverflow.com/questions/44109/extending-the-user-model-wit...
>
> > But now I want the admin every time when he is creating a new user for
> > there to be a new field under Personal Information of a user to have
> > an extra field for Location of user.
>
> That is an old post (2008) - you're better off starting with the
> current 
> documentation:https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional...
>
> Try and follow this and ask back here if you get stuck; showing what
> code you have created and identifying where/how it does not work (also
> see:https://code.djangoproject.com/wiki/UsingTheMailingList)



sorry for the delay in replying
I have added an extra field for the User by doing the whole process
where making User Profile app and extending the User module.

It doesn't seem to error. What I cant figure out, or find anywhere is
how to show this new field in the page where an admin creates a new
user. So under personal information such as First name and last Name I
want there to be Location field that I added to User Profile.

my User Profile:

from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save

class UserProfile(models.Model):
# This field is required.
user = models.OneToOneField(User)

# Other fields here
location = models.CharField(max_length=20)

# definition of UserProfile from above
# ...

def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)
also I would like to know how to make the email mandatory, like
password and username. Just changing the user model in the Django
folder to:

 email = models.EmailField(_('e-mail address'), unique=True)
didn't work at all.

-- 
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: os.system not working for me!

2011-08-02 Thread H . İbrahim Yılmaz
You should use mysqldump command like that:

target_dir = '/path/to/where/you/want/to/dump'

os.system("mysqldump --add-drop-table -c -u user -ppassword database
table > "+target_dir+"/table.bak.sql")

Hope this help!

2011/8/2 dR Hossein 

> Hi every body!
> I want to get backup from my db with os.system command. but it's not work
> for me. \
> this is the code that I'm using:
>
> * os.system("mysqldump --user root password=123 test_db > d:/test.sql")
> *
>
> any body know about this issue?
>
> --
> 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/-/gUbhMh01AQoJ.
> 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.
>



-- 
http://www.arkeoloji.web.tr

-- 
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 smart-select

2011-08-02 Thread H . İbrahim Yılmaz
Any help pls?

2011/8/2 Dr.Linux 

> Hi all,
>
> I'm so sorry for this e-mail. May be you answered similar questions
> many times. But I really need your help to learn how it's works.
>
> There is a little problem with third-level(?) models (or many times
> related models) in admin area with django-smart-selects plugin. I
> don't know what does matter :)
>
> This my colors model
>
> from django.db import models
>
> class Colors(models.Model):
>   color_name = models.CharField(max_length=50
> )
>
>def __unicode__(self):
>return self.color_name
>
> This my Cars models
>
> from django.db import models
>
> class Cars(models.Model):
>car_model = models.CharField(max_length=50
> )
>car_colors = models.ManytoManyField(Colors, related_name='Car
> Colors')
>
>def __unicode__(self):
>return self.car_model
> O.K. Let's see my CarsData Model.
>
> This my CarsData models
>
> from django.db import models
>
> class CarsData(models.Model):
>car_barcode= models.CharField(max_length=5
> 0)
>available_color = ChainedForeignKey(
>   Cars,
>   chained_field="car_model",
>   chained_model_field="car_colors",
>   show_all=False,
>   auto_choose=True
> )
>
>def __unicode__(self):
>return self.car_barcode
> My admin.py looks like that:
>
> from django.contrib import admin
> from django import forms
> from myapp.models import *
>
> class CarsDataAdminForm(forms.ModelForm):
>
>class Meta:
>model = CarsData
>def __init__(self, *arg, **kwargs):
>super(CarsDataAdminForm, self).__init__(*arg, **kwargs)
>self.fields['available_color'].choices =
> [(csc.id,csc.car_colors) for csc in Cars.objects.all()]
>
> class CarsDataAdmin(admin.ModelAdmin):
>form = CarsDataAdminForm
>
> admin.site.register(CarsData,CarsDataAdmin)
>
>
> Is there anyway to show in the ChoiceField 'just' color_name field
> datas? I see just car_model because i have to set it :
>
> def __unicode__(self):
>return self.car_model
>
>
> Can you please give me an example?
>
> Many thanks!




-- 
http://www.arkeoloji.web.tr

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



os.system not working for me!

2011-08-02 Thread dR Hossein
Hi every body!
I want to get backup from my db with os.system command. but it's not work 
for me. \
this is the code that I'm using:

* os.system("mysqldump --user root password=123 test_db > d:/test.sql")
*

any body know about this issue? 

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



django smart-select

2011-08-02 Thread Dr.Linux
Hi all,

I'm so sorry for this e-mail. May be you answered similar questions
many times. But I really need your help to learn how it's works.

There is a little problem with third-level(?) models (or many times
related models) in admin area with django-smart-selects plugin. I
don't know what does matter :)

This my colors model

from django.db import models

class Colors(models.Model):
   color_name = models.CharField(max_length=50
)

def __unicode__(self):
return self.color_name

This my Cars models

from django.db import models

class Cars(models.Model):
car_model = models.CharField(max_length=50
)
car_colors = models.ManytoManyField(Colors, related_name='Car
Colors')

def __unicode__(self):
return self.car_model
O.K. Let's see my CarsData Model.

This my CarsData models

from django.db import models

class CarsData(models.Model):
car_barcode= models.CharField(max_length=5
0)
available_color = ChainedForeignKey(
   Cars,
   chained_field="car_model",
   chained_model_field="car_colors",
   show_all=False,
   auto_choose=True
 )

def __unicode__(self):
return self.car_barcode
My admin.py looks like that:

from django.contrib import admin
from django import forms
from myapp.models import *

class CarsDataAdminForm(forms.ModelForm):

class Meta:
model = CarsData
def __init__(self, *arg, **kwargs):
super(CarsDataAdminForm, self).__init__(*arg, **kwargs)
self.fields['available_color'].choices =
[(csc.id,csc.car_colors) for csc in Cars.objects.all()]

class CarsDataAdmin(admin.ModelAdmin):
form = CarsDataAdminForm

admin.site.register(CarsData,CarsDataAdmin)


Is there anyway to show in the ChoiceField 'just' color_name field
datas? I see just car_model because i have to set it :

def __unicode__(self):
return self.car_model


Can you please give me an example?

Many thanks!

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



enabling readonly inlines

2011-08-02 Thread pradnya
Hi
I have two models namely Test  and UserTest with one to many
relationship.In TestAdmin i have tabular inline for UserTest.

I can add or delete test but can't modify test's fields but in same
object i can add UserTest model but can't modify previously added
UserTest.

So i kept it as readonly by overriding the admin method
get_readonly_fields

but when i click on add another usertest i get a row added to tabular
inline all fields as read only with none values

What i need is to add another user test ,so all fields should be
enabled

and i don't want to enable all fields of tabular inline with java
script

Can u please help me out with this issue

thank you in advance

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



Setting up multi-user site in Django without Admin access

2011-08-02 Thread somecallitblues
Hey guys,

I'm creating a site where multiple users will enter their details and
get access to admin I want to create from them .I want to use default
Django admin as a kind of Super User access for myself. I don't want
these users to have access to Super User admin.

I want them to have their own admins where they can enter some
details, sync with an external web service and create some reports
with the data I pull in from an external site.

So, the way I imagine this is customer comes to my site and signs up.
I generate a kind of console for them. They can access it via
www.mysite.com/customername/console/ and get the reports from the
console.

What I'm not sure about is the following:

-Can this be done in Django?
-Would I use the inbuilt auth framework that's used also in admin or
would I create another? I mean, should I create another Model for
these users or use the existing one that's enabled in applications?
-Also,  how would I setup my urls.py to deal with this type of URL
www.mysite.com/customername/console/? Should I just set it up to parse
www.mysite.com/whatever/console/ and then use views.py to match the /
customername/ part and pull in the info accordingly?

I'm learning Django at the moment and it looks like a framework I can
use for this project, but I just wanted to make sure this can be done
before spending more time on it.

Thanks for your help guys. I appreciate 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.



Re: Django can't see my static files

2011-08-02 Thread Thomas Orozco
Last thing, I made a typo, the address you could use should start with http,
like: http://127.0.0.1/static/
Le 2 août 2011 12:01, "Thomas Orozco"  a écrit :
> A little detail, but you never know: you should put some ' ' in your link.
> Like this :
>
> 
>
>
> If there are spaces in your path, this could cause the lookup to fail.
>
> And even if that's not the case, don't rely on the user's browser to fix
> coding mistakes.
> Le 2 août 2011 10:28, "Guillaume Chorn"  a écrit
:
>> Thomas and Lokesh,
>>
>> Thanks very much for your help. I've modified the link in my HTML file to
>> be:
>>
>> > />
>>
>> where "stylesheet" is the name of the CSS file, and this file is located
>> inside the directory listed under STATIC_DIRS in my settings.py file. As
>> mentioned in my prior email, I also already have STATIC_URL = '/static/'
> in
>> my settings.py file, and I have the correct methods listed under
>> STATICFILES_FINDERS.
>>
>> But it is still not working. Do I have a syntax error somewhere? Or am I
>> still missing something in another file?
>>
>> thanks,
>> Guillaume
>>
>> On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco >wrote:
>>
>>> If your css file is locatedr in your staticfiles dir, you should use
>>> something such as {{ STATIC_URL }}main.css, assuming your CSS file is
> called
>>> main and is located in one of the STATIC_DIRS.
>>>
>>> Using staticfiles_dirs in a template makes no sense. Not only your are
>>> passing a parameter that has to do with your system configuration and
not
>>> your urls, but you are also using a directory instead of a file.
>>>
>>> In short, it is the static_url parameter that should be passed to form a
>>> URL.
>>> Le 1 août 2011 12:17, "Gchorn"  a écrit :
>>>
>>> > Hello All,
>>> >
>>> > I'm using Django to develop a website, and I'm having trouble getting
>>> > it to see my static files. I've looked through Django's static file
>>> > documentation and the steps I've taken to get Django to see my files
>>> > (using a CSS file as an example) are as follows:
>>> >
>>> > First, I created a folder called "static" inside the main app folder
>>> > for this project. Then, I added "/static/" to the STATIC_URLS section
>>> > of the settings.py file, and I also added the full path to my CSS file
>>> > under the STATICFILES_DIRS section of settings.py.
>>> >
>>> > Then I added the line:
>>> >
>>> > from django.template import RequestContext, loader
>>> >
>>> > As well as "context_instance= RequestContext(request)" as a third
>>> > argument to the "return render_to_response()" call.
>>> >
>>> > Finally, in my url.py file, I added this line at the top:
>>> >
>>> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>>> >
>>> > And this line at the bottom (separate from the initial "urlpatterns =
>>> > patterns()" call):
>>> >
>>> > urlpatterns += staticfiles_urlpatterns()
>>> >
>>> > In my HTML/Django template, I added the following link to my CSS file:
>>> >
>>> > 
>>> >
>>> > But then after all of this, when I perform a "python manage.py
>>> > runserver" to preview the website, Django still does not appear to
>>> > find the external CSS file. I must still be missing something but I'm
>>> > not sure what--does anyone know???
>>> >
>>> > I'm sure I'm missing something very basic but I'm a total beginner so
>>> > please be patient with me, I probably need a lot of very specific
>>> > instructions...
>>> >
>>> > thanks,
>>> > Guillaume
>>> >
>>> > --
>>> > 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.
>>

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



Tracking RSS feeds usage

2011-08-02 Thread Dealshelve Team
I am using
https://docs.djangoproject.com/en/dev/ref/contrib/syndication/#a-complex-examplefor
my project.

Since the feed is essentially presented in XML to user, I have no way to
track the access with Google Analytics.
But I am thinking to register that access by sending Django request object
to Google Analytics when I call Feed's items() method.

Has anyone done this before? Or does it even make sense?

-- 
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 can't see my static files

2011-08-02 Thread Thomas Orozco
A little detail, but you never know: you should put some ' ' in your link.
Like this :




If there are spaces in your path, this could cause the lookup to fail.

And even if that's not the case, don't rely on the user's browser to fix
coding mistakes.
Le 2 août 2011 10:28, "Guillaume Chorn"  a écrit :
> Thomas and Lokesh,
>
> Thanks very much for your help. I've modified the link in my HTML file to
> be:
>
>  />
>
> where "stylesheet" is the name of the CSS file, and this file is located
> inside the directory listed under STATIC_DIRS in my settings.py file. As
> mentioned in my prior email, I also already have STATIC_URL = '/static/'
in
> my settings.py file, and I have the correct methods listed under
> STATICFILES_FINDERS.
>
> But it is still not working. Do I have a syntax error somewhere? Or am I
> still missing something in another file?
>
> thanks,
> Guillaume
>
> On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco wrote:
>
>> If your css file is locatedr in your staticfiles dir, you should use
>> something such as {{ STATIC_URL }}main.css, assuming your CSS file is
called
>> main and is located in one of the STATIC_DIRS.
>>
>> Using staticfiles_dirs in a template makes no sense. Not only your are
>> passing a parameter that has to do with your system configuration and not
>> your urls, but you are also using a directory instead of a file.
>>
>> In short, it is the static_url parameter that should be passed to form a
>> URL.
>> Le 1 août 2011 12:17, "Gchorn"  a écrit :
>>
>> > Hello All,
>> >
>> > I'm using Django to develop a website, and I'm having trouble getting
>> > it to see my static files. I've looked through Django's static file
>> > documentation and the steps I've taken to get Django to see my files
>> > (using a CSS file as an example) are as follows:
>> >
>> > First, I created a folder called "static" inside the main app folder
>> > for this project. Then, I added "/static/" to the STATIC_URLS section
>> > of the settings.py file, and I also added the full path to my CSS file
>> > under the STATICFILES_DIRS section of settings.py.
>> >
>> > Then I added the line:
>> >
>> > from django.template import RequestContext, loader
>> >
>> > As well as "context_instance= RequestContext(request)" as a third
>> > argument to the "return render_to_response()" call.
>> >
>> > Finally, in my url.py file, I added this line at the top:
>> >
>> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>> >
>> > And this line at the bottom (separate from the initial "urlpatterns =
>> > patterns()" call):
>> >
>> > urlpatterns += staticfiles_urlpatterns()
>> >
>> > In my HTML/Django template, I added the following link to my CSS file:
>> >
>> > 
>> >
>> > But then after all of this, when I perform a "python manage.py
>> > runserver" to preview the website, Django still does not appear to
>> > find the external CSS file. I must still be missing something but I'm
>> > not sure what--does anyone know???
>> >
>> > I'm sure I'm missing something very basic but I'm a total beginner so
>> > please be patient with me, I probably need a lot of very specific
>> > instructions...
>> >
>> > thanks,
>> > Guillaume
>> >
>> > --
>> > 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.
>

-- 
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 can't see my static files

2011-08-02 Thread Thomas Orozco
Could you show us the following:

Your staticfiles settings.
The link where your browser fetches the css file (see rendered source head
when browsing) to gets 404'ed.

If you are using a local server, you could try using a STATIC URL of
127.0.0.1:8000/static/.
Note that this will not work if you use runserver on 0.0.0.0, on which case
you should use your local IP address.

On a production server you can do the same, just use your server address.

Finally, you probably did but, have you activated staticfiles in your apps ?


Off Topic: media and static are supposed to be two different things, static
is for your actual static files, and media for user-uploaded files, both
work  pretty much the same way, so it's not a fix to use one in place of the
other.

Le 2 août 2011 10:28, "Guillaume Chorn"  a écrit :
>
> Thomas and Lokesh,
>
> Thanks very much for your help.  I've modified the link in my HTML file to
be:
>
> 
>
> where "stylesheet" is the name of the CSS file, and this file is located
inside the directory listed under STATIC_DIRS in my settings.py file.  As
mentioned in my prior email, I also already have STATIC_URL = '/static/' in
my settings.py file, and I have the correct methods listed under
STATICFILES_FINDERS.
>
> But it is still not working.  Do I have a syntax error somewhere?  Or am I
still missing something in another file?
>
> thanks,
> Guillaume
>
>
> On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco 
wrote:
>>
>> If your css file is locatedr in your staticfiles dir, you should use
something such as {{ STATIC_URL }}main.css, assuming your CSS file is called
main and is located in one of the STATIC_DIRS.
>>
>> Using staticfiles_dirs in a template makes no sense. Not only your are
passing a parameter that has to do with your system configuration and not
your urls, but you are also using a directory instead of a file.
>>
>> In short, it is the static_url parameter that should be passed to form a
URL.
>>
>> Le 1 août 2011 12:17, "Gchorn"  a écrit :
>>
>> > Hello All,
>> >
>> > I'm using Django to develop a website, and I'm having trouble getting
>> > it to see my static files. I've looked through Django's static file
>> > documentation and the steps I've taken to get Django to see my files
>> > (using a CSS file as an example) are as follows:
>> >
>> > First, I created a folder called "static" inside the main app folder
>> > for this project. Then, I added "/static/" to the STATIC_URLS section
>> > of the settings.py file, and I also added the full path to my CSS file
>> > under the STATICFILES_DIRS section of settings.py.
>> >
>> > Then I added the line:
>> >
>> > from django.template import RequestContext, loader
>> >
>> > As well as "context_instance= RequestContext(request)" as a third
>> > argument to the "return render_to_response()" call.
>> >
>> > Finally, in my url.py file, I added this line at the top:
>> >
>> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>> >
>> > And this line at the bottom (separate from the initial "urlpatterns =
>> > patterns()" call):
>> >
>> > urlpatterns += staticfiles_urlpatterns()
>> >
>> > In my HTML/Django template, I added the following link to my CSS file:
>> >
>> > 
>> >
>> > But then after all of this, when I perform a "python manage.py
>> > runserver" to preview the website, Django still does not appear to
>> > find the external CSS file. I must still be missing something but I'm
>> > not sure what--does anyone know???
>> >
>> > I'm sure I'm missing something very basic but I'm a total beginner so
>> > please be patient with me, I probably need a lot of very specific
>> > instructions...
>> >
>> > thanks,
>> > Guillaume
>> >
>> > --
>> > 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.

-- 
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+unsubs

Re: Django can't see my static files

2011-08-02 Thread Kejun He
hi,

Did you use the django development server to test it??

I have ever published my project on Lighttpd, but lost all the css.
I solved this problem by specified the midia and site-midia.

Like below on lighttpd.conf

"/site_media/" => "/root/web/Affair/gmadmin/media/",
"/media/" => "/root/web/Affair/gmadmin/media/"

AND


may be you could add a point before "/", like this

STATIC_PATH='./media'

Hope it could give you some help.

regards,
kejun



On Tue, Aug 2, 2011 at 4:28 PM, Guillaume Chorn wrote:

> Thomas and Lokesh,
>
> Thanks very much for your help.  I've modified the link in my HTML file to
> be:
>
>  />
>
> where "stylesheet" is the name of the CSS file, and this file is located
> inside the directory listed under STATIC_DIRS in my settings.py file.  As
> mentioned in my prior email, I also already have STATIC_URL = '/static/' in
> my settings.py file, and I have the correct methods listed under
> STATICFILES_FINDERS.
>
> But it is still not working.  Do I have a syntax error somewhere?  Or am I
> still missing something in another file?
>
> thanks,
> Guillaume
>
>
> On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco 
> wrote:
>
>> If your css file is locatedr in your staticfiles dir, you should use
>> something such as {{ STATIC_URL }}main.css, assuming your CSS file is called
>> main and is located in one of the STATIC_DIRS.
>>
>> Using staticfiles_dirs in a template makes no sense. Not only your are
>> passing a parameter that has to do with your system configuration and not
>> your urls, but you are also using a directory instead of a file.
>>
>> In short, it is the static_url parameter that should be passed to form a
>> URL.
>> Le 1 août 2011 12:17, "Gchorn"  a écrit :
>>
>> > Hello All,
>> >
>> > I'm using Django to develop a website, and I'm having trouble getting
>> > it to see my static files. I've looked through Django's static file
>> > documentation and the steps I've taken to get Django to see my files
>> > (using a CSS file as an example) are as follows:
>> >
>> > First, I created a folder called "static" inside the main app folder
>> > for this project. Then, I added "/static/" to the STATIC_URLS section
>> > of the settings.py file, and I also added the full path to my CSS file
>> > under the STATICFILES_DIRS section of settings.py.
>> >
>> > Then I added the line:
>> >
>> > from django.template import RequestContext, loader
>> >
>> > As well as "context_instance= RequestContext(request)" as a third
>> > argument to the "return render_to_response()" call.
>> >
>> > Finally, in my url.py file, I added this line at the top:
>> >
>> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>> >
>> > And this line at the bottom (separate from the initial "urlpatterns =
>> > patterns()" call):
>> >
>> > urlpatterns += staticfiles_urlpatterns()
>> >
>> > In my HTML/Django template, I added the following link to my CSS file:
>> >
>> > 
>> >
>> > But then after all of this, when I perform a "python manage.py
>> > runserver" to preview the website, Django still does not appear to
>> > find the external CSS file. I must still be missing something but I'm
>> > not sure what--does anyone know???
>> >
>> > I'm sure I'm missing something very basic but I'm a total beginner so
>> > please be patient with me, I probably need a lot of very specific
>> > instructions...
>> >
>> > thanks,
>> > Guillaume
>> >
>> > --
>> > 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.
>

-- 
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: static files (development server)

2011-08-02 Thread Tom Evans
On Tue, Aug 2, 2011 at 5:19 AM, veva...@yandex.ru  wrote:
> I see I don't understand how can I use static files using the
> development server. I saw several answers to this question of other
> people but they are too breaf for me. I think I follow advices but
> without any result.
> Books on Django I have don't explain this problem. Be so kind to
> explain me.
> My local computer has Windows. The project folder is c:/djangomysites/
> testjquery, it contains subfolders static and templates, static
> contains subfolders images and js.
> Today I changed Django 1.2.3 to Django 1.3. May I consider images for
> simplicity. For the same reason I don't use "os" function here.
>
> settings.py contains:
> STATICFILES_DIRS = (
>    'c:/djangomysites/testjquery/static',
> )
> STATIC_ROOT=''
> STATIC_URL='/static/'
>
> urls.py contains:
> urlpatterns = patterns('',
>    (r'^', 'testjquery.views.first'),
> if settings.DEBUG:
>    urlpatterns += patterns('',
>    (r'^static/(?P.*)$', 'django.views.static.serve',
>        { 'document_root': 'c:/djangomysites/testjquery/static' })
>
> views.py contains:
> def first(request):
>    return render_to_response('index.html',
> context_instance=RequestContext(request))
>
> index.html contains:
> 
>
> As a result, I get  in the
> produced html-file. But the image file can't be loaded.
> Thank You very much!
>

The staticfiles app works in several steps.

First, you define the folders that staticfiles will collect files
from. These are the project static file folders listed in
settings.STATICFILES_DIRS, and the per-application static folder, eg
/static.

Next, you instruct django to collect the files into place, using the
collectstatic management command. This collects up all the files from
all the places configured in the previous step, and places them in
settings.STATIC_ROOT. This step isn't required in development, the
files do not need to be collected together, although by running this
step, you will see precisely what files are collected and where they
are put.

Next, you configure your webserver to serve the files. In apache, you
would set "Alias $STATIC_URL $STATIC_ROOT" (obviously, replacing with
the correct values, '$STATIC_URL' is meaningless to apache).
In development, you add this to your urlconf:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()

Finally, you update your templates to use STATIC_URL to refer to the files.

It is usually helpful to put prefixes on your static files, since each
folder is imported as it is found, and when a duplicate filename is
encountered, the first found one is used. Eg, with this folder
structure:
.
├── app1/
│   └── static/
│   └── base.css
└── app2/
└── static/
└── base.css

only app1/static/base.css will be collected, and will be made
available at {{ STATIC_URL }}/base.css. It is better to put files
inside a folder that will uniquely identify them, eg:
.
├── app1/
│   └── static/
│   └── app1/
│   └── base.css
└── app2/
└── static/
└── app2/
└── base.css

so that you can refer to {{ STATIC_URL }}/app1/base.css or {{
STATIC_URL }}/app2/base.css.

So, what you are not doing, is not configuring the urlconf correctly.
Use the example from the docs, you should not be specifying the
document_root.

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: Komodo IDE better screenshots (worth reading!)

2011-08-02 Thread Derek
Been using Komodo for over a year - it has never crashed on me (that
I've noticed anyway ;)

On Aug 1, 10:19 am, Thomas Weholt  wrote:
> Hmmm ... I've had the same problem using PyCharm; it just doesn't look
> good, but after a while I stopped noticing and started loving the
> features of that IDE. Tried PyCharm Cal? The last time I tried Komodo
> it crashed big time. I'd been using Komodo for a while and the bugs
> might have been fixed now, but I got a license for PyCharm cuz of DSE
> and haven't looked at anything else since.
>
> Big thanks to JetBrains for the free license. Apply for a license here
> :http://www.jetbrains.com/eforms/openSourceRequest.action?licenseReque
>
> Regards,
> Thomas
>
> On Wed, Jul 20, 2011 at 2:25 PM, Cal Leeming [Simplicity Media Ltd]
>
>
>
>
>
>
>
>
>
>  wrote:
> > For me, looks are extremely important when it comes to an IDE, especially
> > when I spend 12+ hours a day doing nothing but Django/Python development.
> > When looking at Komodo, I *almost* rejected it on the basis that all the
> > available screenshots looks hideous.
> > OSX: http://www.i-cherubini.it/mauro/blog/uploads/images/ss_Komodo_rails_l...
> > Linux: http://www.qweas.com/downloads/development/other/scr-komodo-ide.png
> > Windows:
> >http://www.activestate.com/sites/default/files/images/komodo/platform...
> > So, after some config modifications, and a few plugins, here is a screenshot
> > of how clean/pretty it is now:
> >http://i.imgur.com/OsKuL.png
> >http://i.imgur.com/UuXmO.png
> > For this I'm using:
> > font: Consolas 8px
> > addons: aero theme, FamFamFam Silk Icons, NST, Tweak UI
> > tweak ui: Used to move tabs around the screen
> > config: horizontal tabs instead of vertical.
> > screen size: 1920x1080
> > The toolbox is also a lovely little feature (lets you add all sorts of
> > custom macros and auto runs)
> > Downside, the 'formatting/reindentation' selection tool is absolutely
> > terrible (it just doesn't work lol).
> > Hope this helps someone else.
> > Cal
>
> > --
> > 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.
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org

-- 
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 can't see my static files

2011-08-02 Thread Guillaume Chorn
Thomas and Lokesh,

Thanks very much for your help.  I've modified the link in my HTML file to
be:



where "stylesheet" is the name of the CSS file, and this file is located
inside the directory listed under STATIC_DIRS in my settings.py file.  As
mentioned in my prior email, I also already have STATIC_URL = '/static/' in
my settings.py file, and I have the correct methods listed under
STATICFILES_FINDERS.

But it is still not working.  Do I have a syntax error somewhere?  Or am I
still missing something in another file?

thanks,
Guillaume

On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco wrote:

> If your css file is locatedr in your staticfiles dir, you should use
> something such as {{ STATIC_URL }}main.css, assuming your CSS file is called
> main and is located in one of the STATIC_DIRS.
>
> Using staticfiles_dirs in a template makes no sense. Not only your are
> passing a parameter that has to do with your system configuration and not
> your urls, but you are also using a directory instead of a file.
>
> In short, it is the static_url parameter that should be passed to form a
> URL.
> Le 1 août 2011 12:17, "Gchorn"  a écrit :
>
> > Hello All,
> >
> > I'm using Django to develop a website, and I'm having trouble getting
> > it to see my static files. I've looked through Django's static file
> > documentation and the steps I've taken to get Django to see my files
> > (using a CSS file as an example) are as follows:
> >
> > First, I created a folder called "static" inside the main app folder
> > for this project. Then, I added "/static/" to the STATIC_URLS section
> > of the settings.py file, and I also added the full path to my CSS file
> > under the STATICFILES_DIRS section of settings.py.
> >
> > Then I added the line:
> >
> > from django.template import RequestContext, loader
> >
> > As well as "context_instance= RequestContext(request)" as a third
> > argument to the "return render_to_response()" call.
> >
> > Finally, in my url.py file, I added this line at the top:
> >
> > from django.contrib.staticfiles.urls import staticfiles_urlpatterns
> >
> > And this line at the bottom (separate from the initial "urlpatterns =
> > patterns()" call):
> >
> > urlpatterns += staticfiles_urlpatterns()
> >
> > In my HTML/Django template, I added the following link to my CSS file:
> >
> > 
> >
> > But then after all of this, when I perform a "python manage.py
> > runserver" to preview the website, Django still does not appear to
> > find the external CSS file. I must still be missing something but I'm
> > not sure what--does anyone know???
> >
> > I'm sure I'm missing something very basic but I'm a total beginner so
> > please be patient with me, I probably need a lot of very specific
> > instructions...
> >
> > thanks,
> > Guillaume
> >
> > --
> > 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: clear/empty text field on every POST

2011-08-02 Thread Reikje
Good workaround :) Adding it. Thanks

On Aug 1, 12:05 pm, lokesh  wrote:
> hi,
>  Use Javascript or jquery .reset() to clear the form fields .
> Lokesh S
>
> On Aug 1, 1:41 pm, Reikje  wrote:
>
> > Hi,
>
> > I am using django.Forms for a website. I have a text field which is
> > not required. Every time it is posted, I do not retain what was
> > entered in this field, i.e. it should be blank every time the page is
> > rendered. What is the best way to archive this? Here is the form:
>
> > class SuggestionForm(forms.Form):
> >         suggested_name = forms.CharField(max_length=50,
> > required=False, widget=forms.TextInput(attrs={'class': 'profile
> > textfield'}))

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