Re: Best way to template "," and "and" separated lists?

2008-02-06 Thread toomim

On Feb 6, 11:05 pm, toomim <[EMAIL PROTECTED]> wrote:
> I don't understand, how do I get {{sep}} to change from ',' to 'and'
> and then to the empty string in the last 2 iterations of the loop,
> without using a bunch of if statements? (And since we're using
> variables, a {% where %} clause?)

Here's my code, if it helps:

{% for pubauthor in pub.pubauthor_set.all %}
{{ pubauthor.author }}{% if forloop.last %}{% else %}{% ifequal forloop.revcounter 2 %}
and {% else %},
{% endifequal %}
{% endif %}
{% endfor %}

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



Re: Best way to template "," and "and" separated lists?

2008-02-06 Thread toomim

On Feb 6, 9:25 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 07-Feb-08, at 10:45 AM, toomim wrote:
>
> compute and add these in your view - you need an extra field, say,  
> 'sep' which would be ',', '' or 'and' and in your template:
> whatever {{sep}}

I don't understand, how do I get {{sep}} to change from ',' to 'and'
and then to the empty string in the last 2 iterations of the loop,
without using a bunch of if statements? (And since we're using
variables, a {% where %} clause?)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best way to template "," and "and" separated lists?

2008-02-06 Thread toomim

On Feb 6, 9:29 pm, "Swaroop C H" <[EMAIL PROTECTED]> wrote:
> If I've understood your question correctly, you can use 'forloop.last'
> to determine if you're in the last iteration... 
> seehttp://www.djangobook.com/en/1.0/chapter04/for details.

Yes, that's what I use for the last iteration. Then I use {% ifequal
forloop.revcounter 2 %} for the second-to-last, and just end up with a
ton of ugly if and else statements that should be easier to express.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best way to template "," and "and" separated lists?

2008-02-06 Thread Swaroop C H

On Feb 7, 2008 10:45 AM, toomim <[EMAIL PROTECTED]> wrote:
>
> I am looping through a list of people, and want to output their
> hyperlinked names separated by commas and then the word "and".


If I've understood your question correctly, you can use 'forloop.last'
to determine if you're in the last iteration... see
http://www.djangobook.com/en/1.0/chapter04/ for details.

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



Re: Best way to template "," and "and" separated lists?

2008-02-06 Thread Kenneth Gonsalves


On 07-Feb-08, at 10:45 AM, toomim wrote:

> What is the best way of implementing this in a django template? Right
> now I'm using a {% for %} loop, where each iteration prints a "," or
> "and" or nothing depending on the iteration of the loop, using a bunch
> of {% if %} statements to branch on these three cases.
>
> This seems like it must be a common task though... is there a better
> way?

compute and add these in your view - you need an extra field, say,  
'sep' which would be ',', '' or 'and' and in your template:
whatever {{sep}}

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



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



Best way to template "," and "and" separated lists?

2008-02-06 Thread toomim

I am looping through a list of people, and want to output their
hyperlinked names separated by commas and then the word "and". It
should look like this:

Bob,
Fred,
Deidre and
Kelly

What is the best way of implementing this in a django template? Right
now I'm using a {% for %} loop, where each iteration prints a "," or
"and" or nothing depending on the iteration of the loop, using a bunch
of {% if %} statements to branch on these three cases.

This seems like it must be a common task though... is there a better
way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Strange issue with too many Foriegn Keys

2008-02-06 Thread Michael Newman

THANK YOU so much. That was exactly what I was looking for. A bit of a
hack fix. Maybe I can look into writing a patch for it since I am
going to need to work on a fix that I feel comfortable with anyways.

I started looking at new forms the last couple of hours thinking that
would be a fix. It looks really promising. Problem is I need this for
a production site. Anyone recommend moving to a branch if I am
interested in switching? Is it stable and will the code be forwards
compatible as it merges? Once this site goes live (in the next few
weeks) I won't really be able to revisit it for a while.

On Feb 6, 10:17 pm, Aaron Fay <[EMAIL PROTECTED]> wrote:
> Hey Michael,
>
> I ran across this article a couple days ago that seems to have a
> workaround to your problem:
>
> http://scottbarnham.com/blog/2007/08/22/edit-inline-with-imagefield-o...
>
> Hope that helps,
> Aaron
>
> Michael Newman wrote:
> > I am trying this new way of inheriting a lot of information for a
> > project I am working on. This site I need to extend the user profile,
> > then certain people can have their own sites and then those sites can
> > have 10 photographs to add to a slide show.
>
> > so I have:
>
> > exampleapp.py
> > -- models.py
>
> > class Profile(models.Model):
> >models.ForeignKey(User, unique=True)
> >...
>
> > class WebSite(models.Model):
> >models.ForeignKey(Profile)
> >...
>
> > class WebsiteImage(models.Model):
> >models.ImageField(upload_to='myimagedir', core=True)
> >models.ForiegnKey(WebSite, edit_inline=models.TABULAR,
> > num_in_admin=10,max_num_in_admin=10)
> >...
>
> > I create a Website and save a bunch of images. I click back on the
> > WebSite to edit it. I click save without editing anything. Go back to
> > look at the item and the Images are no longer there. Nor are the
> > database tables.
>
> > This is really confusing. Does anyone have any ideas? Is this a known
> > issue or something dumb that I am doing? Thanks in advance for any
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Which markup language to choose?

2008-02-06 Thread Eric Abrahamsen

> For a) it's important for me to have the possibility to embed raw  
> HTML. AFAIK markdown provides hat possiblity, is it also possible with  
> textile and reST?

I'm definitely a fan of markdown (I do most of my writing in it), and
it's more than sufficient for any online needs. I tend to import it
into my models and use it in custom save methods, rather than using
the template filter, since it offers more flexibility and less runtime
load that way. That said, I did make a patch to add some more
functionality into the template filter:
http://code.djangoproject.com/ticket/6526

you might find that useful.

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



New Django Site - tsacomplaints.com

2008-02-06 Thread slartiblartfast

hey guys - im about to formally launch a new site done with django
called TSA Complaints (http://www.tsacomplaints.com)

the site is a response to the hundreds of comments taking the TSA to
task for their well-deserved reputation of being ineffective, lax, and
generally obnoxious. i hope for it to become a forum for complaints,
housing the opinion of travelers inconvenienced by the company thats
supposed to be keeping them safe. eventually, once enough input has
been given, ill be excitedly mining the results on a regular basis
(probably weekly-monthly) and publishing the results to watch trends
in both the short and long (historical) term.

before the grand opening, i'd really appreciate any feedback,
comments, wisdom or content (especially content!) that the django
users community has to offer. this is the first kinda-big scale
project i've launched, too.


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



Re: Strange issue with too many Foriegn Keys

2008-02-06 Thread Aaron Fay

Hey Michael,

I ran across this article a couple days ago that seems to have a 
workaround to your problem:

http://scottbarnham.com/blog/2007/08/22/edit-inline-with-imagefield-or-filefield-in-django-admin/

Hope that helps,
Aaron

Michael Newman wrote:
> I am trying this new way of inheriting a lot of information for a
> project I am working on. This site I need to extend the user profile,
> then certain people can have their own sites and then those sites can
> have 10 photographs to add to a slide show.
>
> so I have:
>
> exampleapp.py
> -- models.py
>
> class Profile(models.Model):
>models.ForeignKey(User, unique=True)
>...
>
> class WebSite(models.Model):
>models.ForeignKey(Profile)
>...
>
> class WebsiteImage(models.Model):
>models.ImageField(upload_to='myimagedir', core=True)
>models.ForiegnKey(WebSite, edit_inline=models.TABULAR,
> num_in_admin=10,max_num_in_admin=10)
>...
>
> I create a Website and save a bunch of images. I click back on the
> WebSite to edit it. I click save without editing anything. Go back to
> look at the item and the Images are no longer there. Nor are the
> database tables.
>
> This is really confusing. Does anyone have any ideas? Is this a known
> issue or something dumb that I am doing? Thanks in advance for any
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



godaddy django support

2008-02-06 Thread sserrano

Hi everybody

I have write this to the godaddy support team:

> Customer Inquiry
> Hi
> I have been a godaddy customer for a long time and the hosting has been
> very useful. But i have been improving my webdevelopment skills and now I'm
> willing to migrate from php to a python webframework called django. Sadly is
> not possible to run django on the shared hostings of godaddy, mainly for the
> lack of the python module mysqldb.
> I will like to now if there are any plans to support this framework, i
> know I'm not the only godaddy costumer that will appreciate run django on a
> godaddy account, just search "django godaddy" on google and you will see.
> If there is no plan to support django in the near future i will be
> migrating to webfaction, I'm sorry.
>
> Best Regards, Sebastian Serrano.-

And get this answer:

> Support Staff Response
> We've have plans to upgrade our CGI offerings very soon. We'll take Django in 
> to consideration > as we make those upgrades. Thank you.

With some luck and a little more pressure from the customers, django
will get support on godaddy.

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



Re: Performance problem. Server overloading with a lot of apache processes

2008-02-06 Thread Michael Newman

Reality is 19 apache processes isn't that much. That means there are
only about 19 requests on your server at one time. So what that means
is that either your server is whoafully unprepared for the real world,
or what is being done with your processes is really heavy, like file
uploading or processing. CGI might actually increase the memory usage
by your system if you are uploading files and lighttp only will help
marginally with your static media files.

If it is file processing and heavy scripts is all you are doing,
caching will really help your server load because it will limit the
time each request takes on the server. If it is file uploading it's
time to think of a more powerful server or server array, because you
need a persistent connection with a relatively large amount of memory
being used.

All my research and trials with lighttp and nginx have come up with
the same conclusion: the savings in server load isn't worth the
effort. They are more of a tweaking thing. Clean code and the smallest
requests possible make for an easy server load that ultimately scales
well and is well worth the effort.

By all means feel free to try other solutions. There are tons of
tutorials out there and Django is so portable that you won't need to
spend too much time rewriting code just configuring the web server.
But from my experience you might want to revisit your code or ask
exactly you are trying to do and decide if your server is capible.

Anyways, iyi sanslar ve kolay gelsin!!!


On Feb 6, 6:52 pm, Eren Türkay <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I have a project that has a lot of models and database relationship is little
> complex. I run my code with apache2 and mod_python. My problem is that there
> is a lot of apache processes and these eat too much memory.
>
> Yesterday, 10 minutes after I announced the site's new design, the server was
> overloaded and I wasn't able to login into it via ssh for 6 hours. When I
> logged, I realized that there was ~19 apache processes and the consume of
> memory was %99! I rebooted the machine and everything looked well, but still
> there were lots of apaches. I checked logs, there wasn't DDOS attack or
> something else, it was just regular visiting of users.
>
> Is it normal? I don't think so. Now I'm thinking of using lighttpd and cgi. I
> hope, this will reduce CPU and MEM usage but I don't know if it will work.
>
> Using cache mechanism can be suggested but I don't think it's related with
> apache's mem/cpu usage.
>
> Has someone faced this problem before? Any ideas?
>
> Regards,
> Eren
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unicode error

2008-02-06 Thread Corey Oordt

Kristian,

I had a similar problem when I needed to send some ASCII emails. I  
have a snippet at does a translation of unicode characters to close  
ASCII approximations if it is helpful:

http://www.djangosnippets.org/snippets/588/

Corey


On Feb 5, 2008, at 3:48 PM, Kristian Øllegaard wrote:

> Hi again
>
> Ok - my bad.
>
> Thanks a lot
>
> Regards
> Kristian
>
> On Feb 5, 2008 9:29 PM, Jacob Kaplan-Moss  
> <[EMAIL PROTECTED]> wrote:
>
> On 2/5/08, Kristian Øllegaard <[EMAIL PROTECTED]> wrote:
> > Is there an obvious thing i did wrong? Have you heard about this  
> error
> > before?
>
> This is because of the changes in Unicode handling after 0.96; read
> more here: 
> http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist
>
> In general, if you've upgraded from 0.96 you *need* to read the
> backwards-incompatible changes list:
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges. When
> we release new versions, that list becomes the release notes, but if
> you're running off a trunk checkout you need to be aware of the
> changes.
>
> Jacob
>
>
>
> >


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



Re: Improperly configured exception

2008-02-06 Thread Schmoopie

Update on this: the problem was in sys.path: this must contain the
directory where the models.py file is located. So, progress.

BUT, now I get the error 'Import Error, could not import settings',
and for some reason it claims it can't find the mysite.settings
module. Again, I am stumped -- why would it fail to find that when it
clearly exists?


On Feb 6, 4:52 pm, Schmoopie <[EMAIL PROTECTED]> wrote:
> I looked into this. mysite.urls exists, no syntax errors, but it seems
> that when it tries to import from a models.py file, it goes looking
> for that file in a completely different directory, which in fact no
> longer exists. Weird.
>
> Is this an environment variable problem? Why would it go looking for
> the models file on some distant path?
>
> On Feb 5, 11:24 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]>
> wrote:
>
> > On 2/5/08, Schmoopie <[EMAIL PROTECTED]> wrote:
>
> > > Improperly configured
> > > Error while importing URLconf 'mysite.urls'
>
> > > but there is no explanation here as to what is wrong with the
> > > configuration. What could be causing this?
>
> > It probably means that your ROOT_URLCONF, `mysite.urls`, is missing or
> > has a syntax error. Try importing it from the shell:
>
> > $ ./manage.py shell
>
> > >>> import mysite.urls
>
> > And see what happens. That should show you the error.
>
> > Jacob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Improperly configured exception

2008-02-06 Thread Schmoopie

Update on this: the problem was in sys.path: this must contain the
directory where the models.py file is located. So, progress.

BUT, now I get the error 'Import Error, could not import settings',
and for some reason it claims it can't find the mysite.settings
module. Again, I am stumped -- why would it fail to find that when it
clearly exists?


On Feb 6, 4:52 pm, Schmoopie <[EMAIL PROTECTED]> wrote:
> I looked into this. mysite.urls exists, no syntax errors, but it seems
> that when it tries to import from a models.py file, it goes looking
> for that file in a completely different directory, which in fact no
> longer exists. Weird.
>
> Is this an environment variable problem? Why would it go looking for
> the models file on some distant path?
>
> On Feb 5, 11:24 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]>
> wrote:
>
> > On 2/5/08, Schmoopie <[EMAIL PROTECTED]> wrote:
>
> > > Improperly configured
> > > Error while importing URLconf 'mysite.urls'
>
> > > but there is no explanation here as to what is wrong with the
> > > configuration. What could be causing this?
>
> > It probably means that your ROOT_URLCONF, `mysite.urls`, is missing or
> > has a syntax error. Try importing it from the shell:
>
> > $ ./manage.py shell
>
> > >>> import mysite.urls
>
> > And see what happens. That should show you the error.
>
> > Jacob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sorting by another table

2008-02-06 Thread Andriy Khavryuchenko

[EMAIL PROTECTED] написав(ла):
> I have a Sale model that foreign keys into an APN model, which
> foreign keys into a Zip model. I'd like to sort my Sale objects by
> the 'zip' field on the Zip model, but
> 
> Sale.objects.select_related().order_by('sales_zip.zip')
> 
> doesn't work (1054, "Unknown column 'sales_zip.zip' in 'order
> clause'"). It only works if I sort by something on the APN model,
> which is one foreign-key hop instead of two.
> 
> Is there an easy way to do this? Am I missing something? I'm running
> 0.96 but not opposed to the trunk alternative.

You might take want to add an
extra(table=['sales_zip'])
to your query.  The other table doesn't gets into the sql statement by
default.

This might be available only on trunk.

-- 
Sincerely,

Andrey Khavryuchenkohttp://a.khavr.com/
KDS Software Group  http://www.kds.com.ua/
Software Solutions Company

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



Performance problem. Server overloading with a lot of apache processes

2008-02-06 Thread Eren Türkay

Hello all,

I have a project that has a lot of models and database relationship is little 
complex. I run my code with apache2 and mod_python. My problem is that there 
is a lot of apache processes and these eat too much memory.

Yesterday, 10 minutes after I announced the site's new design, the server was 
overloaded and I wasn't able to login into it via ssh for 6 hours. When I 
logged, I realized that there was ~19 apache processes and the consume of 
memory was %99! I rebooted the machine and everything looked well, but still 
there were lots of apaches. I checked logs, there wasn't DDOS attack or 
something else, it was just regular visiting of users.

Is it normal? I don't think so. Now I'm thinking of using lighttpd and cgi. I 
hope, this will reduce CPU and MEM usage but I don't know if it will work.

Using cache mechanism can be suggested but I don't think it's related with 
apache's mem/cpu usage.

Has someone faced this problem before? Any ideas? 

Regards,
Eren

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



Re: [newbie]Apache Deployment Problem

2008-02-06 Thread Kenneth Gonsalves


On 06-Feb-08, at 7:41 PM, Tony Winslow wrote:

> I installed mod_python and do the configurations as the tutorial on  
> the
> official site. But mod_python still can not find the mysite.settings
> module. What might be the problem?

paste the relevant part of your apache config

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



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



Re: django version for production?

2008-02-06 Thread Pigletto


On 6 Lut, 04:50, "Christian W. Koch" <[EMAIL PROTECTED]> wrote:
> i'm no django expert, yet, but i use trunk. now, for production
> purposes i still use trunk because before i "svn up" on production i
> make sure that the site runs on my development box on the latest
> trunk.
>
> you do have a development environment, right? ;)
In fact I have 3 environments:
1. developement (dev server at developer machines)
2. testing environment (available for customers etc. - identical to
production environment)
3. production environment

When I'm finished with some functionality (iteration), I make a tag in
svn. Then, this tagged version is deployed at test environment.
Customer checks it etc and if accepted it goes to production (using
svn tag). If not accepted, then fixes are made and next version is
commited into tags at svn. Then it goes into test environment again.
My taged version contains .tar.gz with django used by this application
version so it is easy to maintain.

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



Re: Which markup language to choose?

2008-02-06 Thread Nathaniel Whiteinge

On Feb 6, 2:55 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
> For a) it's important for me to have the possibility to embed raw
> HTML. AFAIK markdown provides hat possiblity, is it also possible with
> textile and reST?

For a) you'll never be left wanting with RestructuredText. It is *by
far* the most flexible. All the Django docs are done using it (which
is also a good place to look at examples). I even use it for school
papers. You can produce a variety of slick-looking output, check out
rst2a.com [1] for examples and download-able style sheets. If you're
on a Mac, there's a pretty slick GUI program [2] for composing it too.

.. [1] http://www.rst2a.com/
.. [2] http://python.net/~gherman/ReSTedit.html
(not sure if the above link is the latest version...)

> For b) it's important the output is more or less pretty also if the
> writer is not aware of using a markup language. Or should I just stick
> with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}?

For b) I'm pretty ambivalent. Textile seems to be on the way out
though.

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



Re: Code upgrade

2008-02-06 Thread James Bennett

On Feb 6, 2008 3:30 PM, Chris <[EMAIL PROTECTED]> wrote:
> Does magic removal help to upgrade code from 91 to present or is it a
> set of code used to assist with writing a potential application that
> could do this?

"Magic-removal" is not a script or a piece of code. It was the name
given to the lengthy process of rewriting most of Django's internals
between version 0.91 and 0.95. The page I linked you to is a list of
the things which you will need to change in your own application code
in order to adapt to how drastically Django changed between those
versions. I know of no publicly-available script which can
automatically apply those changes to your application; as I know all
too well, migrating a legacy Django application from those earliest
releases is simply a long process which has to involve manual effort.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: User permissions

2008-02-06 Thread James Bennett

On Feb 6, 2008 4:38 PM, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
> ... though given the choices, I'd be inclined to wager that it's
> closer to "now" than to "the heat death of the universe"...

Probably, but I always include that in the time scale just in case.
You know how tricky it is to estimate software development.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Strange issue with too many Foriegn Keys

2008-02-06 Thread Michael Newman

I am trying this new way of inheriting a lot of information for a
project I am working on. This site I need to extend the user profile,
then certain people can have their own sites and then those sites can
have 10 photographs to add to a slide show.

so I have:

exampleapp.py
-- models.py

class Profile(models.Model):
   models.ForeignKey(User, unique=True)
   ...

class WebSite(models.Model):
   models.ForeignKey(Profile)
   ...

class WebsiteImage(models.Model):
   models.ImageField(upload_to='myimagedir', core=True)
   models.ForiegnKey(WebSite, edit_inline=models.TABULAR,
num_in_admin=10,max_num_in_admin=10)
   ...

I create a Website and save a bunch of images. I click back on the
WebSite to edit it. I click save without editing anything. Go back to
look at the item and the Images are no longer there. Nor are the
database tables.

This is really confusing. Does anyone have any ideas? Is this a known
issue or something dumb that I am doing? Thanks in advance for any
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User permissions

2008-02-06 Thread Jacob Kaplan-Moss

On 2/6/08, James Bennett <[EMAIL PROTECTED]> wrote:
> Some amount of time between "now" and "the heat death of the
> universe". There is no estimate, no timeline, no schedule, no ETA, no
> guess, nor any other synonym of any of those words.

... though given the choices, I'd be inclined to wager that it's
closer to "now" than to "the heat death of the universe"...

Jacob

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



Re: Which markup language to choose?

2008-02-06 Thread Petite Abeille


On Feb 6, 2008, at 10:55 PM, Florian Lindner wrote:

> I'm writing my own blogging application for Django (yes, I want to
> reinvent the wheel, for learning and fun) ;-)

More power to you! :P

> According to documentation django.contrib.markup provides an interface
> to markdown, textile and restructered text. Now I wonder which one to
> choose for a) blog entries b) comments
>
> For a) it's important for me to have the possibility to embed raw
> HTML. AFAIK markdown provides hat possiblity, is it also possible with
> textile and reST?
>
> For b) it's important the output is more or less pretty also if the
> writer is not aware of using a markup language. Or should I just stick
> with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}?
>
> What are your experiences?

Personally, I would favor Markdown as it would address (a) and (b) out  
of the box, i.e. you can get fancy stuff in raw HTML if needed and  
people not aware of the syntax will get decent result out-of-the-box...

As an example, here is a, hmm, homemade wiki engine which uses Markdown:

http://svr225.stepx.com:3388/main
http://svr225.stepx.com:3388/main.txt
http://svr225.stepx.com:3388/main/editor

Tangentially related... Once you have your blogging app up and  
running... read a bit about spambots :))

http://nedbatchelder.com/text/stopbots.html

Cheers,

PA.

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



Re: ImportError: No module named base

2008-02-06 Thread [EMAIL PROTECTED]

Hello!

On 15 Jan., 15:38, Chris Pratt <[EMAIL PROTECTED]> wrote:
> I'm getting the following error message when running "python manage.py
> runserver"

It's the same here - Mac OS 10.5.1 (Leopard), Python 2.5.1 from
Macports.
Did you find a solution or workaround to fix it?

Thanks in advance,
   Ralf

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



Re: Which markup language to choose?

2008-02-06 Thread Rajesh Dhawan

On Feb 6, 4:55 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm writing my own blogging application for Django (yes, I want to
> reinvent the wheel, for learning and fun) ;-)
> According to documentation django.contrib.markup provides an interface
> to markdown, textile and restructered text. Now I wonder which one to
> choose for a) blog entries b) comments
>
> For a) it's important for me to have the possibility to embed raw
> HTML. AFAIK markdown provides hat possiblity, is it also possible with
> textile and reST?
>
> For b) it's important the output is more or less pretty also if the
> writer is not aware of using a markup language. Or should I just stick
> with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}?
>
> What are your experiences?

I prefer Markdown for the following main reasons:

- simplicity (I feel that Markdown's input text is cleaner, more
legible than Textile's)
- its ability to intermix HTML (great for blog entries)
- the Python Markdown library has a nice "safe_mode" attribute which
can get rid of HTML tags if you don't want them (great for escaping
comments and other untrusted user content)
- I like the way Markdown does hard breaks only when asked explicitly
unlike Textile's "always break on \n" behaviour.

I have no practical experience using reST.

In any case, you should do some research of your own. Also, perhaps
look at other Django bloggers that you trust and see what they like. I
suppose you are already doing this via your post :)

For comments, you don't really need much more than the ability to do
links, bold, italics, and paragraphs. Any of your above 3 markup
languages will deal with that easily.

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



Re: sorting by another table

2008-02-06 Thread Rajesh Dhawan

On Feb 6, 3:50 pm, <[EMAIL PROTECTED]> wrote:
> I have a Sale model that foreign keys into an APN model, which foreign keys 
> into a Zip model. I'd like to sort my Sale objects by the 'zip' field on the 
> Zip model, but
>
> Sale.objects.select_related().order_by('sales_zip.zip')
>
> doesn't work (1054, "Unknown column 'sales_zip.zip' in 'order clause'"). It 
> only works if I sort by something on the APN model, which is one foreign-key 
> hop instead of two.

It may be that the Zip table is not getting joined in when Django
constructs the SQL query. For a start, you should go into debug mode,
and print out the query that Django is creating. See:

http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running

Perhaps Django is bringing in the table "sales_zip" under a different
name. I've had cases where it would bring such a table in under the
alias sales_zip2, etc. for good reason.s

Now, the use of "select_related()" should join in that table, but may
be APN.zip is a nullable ForeignKey?

-Rajesh D

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



Which markup language to choose?

2008-02-06 Thread Florian Lindner

Hello,
I'm writing my own blogging application for Django (yes, I want to  
reinvent the wheel, for learning and fun) ;-)
According to documentation django.contrib.markup provides an interface  
to markdown, textile and restructered text. Now I wonder which one to  
choose for a) blog entries b) comments

For a) it's important for me to have the possibility to embed raw  
HTML. AFAIK markdown provides hat possiblity, is it also possible with  
textile and reST?

For b) it's important the output is more or less pretty also if the  
writer is not aware of using a markup language. Or should I just stick  
with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}?

What are your experiences?

Thanks,

Florian


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



Re: {% load %} tag in a base template can't be inherited?

2008-02-06 Thread Adam Stein

On Wed, 2008-02-06 at 13:02 -0800, koenb wrote:
> BTW, you can add tags to builtins if you need them all the time.
> 
> eg. if you need i18n all over:
> 
> from django.template import add_to_builtins
> add_to_builtins('django.templatetags.i18n')

Thanks for the info.  Where would I put this?

-- 
Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]

Disclaimer: All views expressed 
here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]


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



Re: Code upgrade

2008-02-06 Thread Chris

James,

Does magic removal help to upgrade code from 91 to present or is it a
set of code used to assist with writing a potential application that
could do this?

Thanks for all your help. You are very helpful on this forum.

Chris

On Feb 5, 3:17 pm, Chris <[EMAIL PROTECTED]> wrote:
> so does anyone have such a script on hand.  I have partially written
> one that uses regular expressions to evaluate everything but I think
> that it is still quite a ways off from getting it to a working point.
>
> On Feb 5, 1:52 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On Feb 5, 2008 12:33 PM, David Marquis <[EMAIL PROTECTED]> wrote:
>
> > > If you didn't make any change to the Django source base, you can
> > > simply download the latest release and install the new version.
> > > If needed, you could also download the latest development version
> > > through the Subversion repository.
>
> > No, he can't. Between Django 0.91 and Django 0.95 there were huge
> > numbers of massive backwards-incompatible changes; code that ran on
> > 0.91 and earlier has to be fairly thoroughly rewritten in order to run
> > on 0.95 or higher.
>
> > The full list of necessary changes is preserved here:
>
> >http://code.djangoproject.com/wiki/RemovingTheMagic
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Brandon Taylor

Hi Aaron,

I'm assuming that it doesn't have errors, as I can run the website
using the built-in server. It's just an new, empty project, so all I
get is the django welcome page. I'm hoping I'll have better luck
configuring my Mac at home, which is where I'll be doing 99% of my
development anyway.

Not being able to run the websites through Apache/mod_python isn't a
showstopper though. I can always use the built-in server, much the
same way I run Rails projects through a Mongrel instance as I'm
developing. I deploy my Rails sites to an Apache/FastCGI environment,
and they work perfectly. Hopefully I'll have the same experience with
Django.

I haven't had a chance to try configuring Apache to work with FastCGI
on my Windows box. Maybe I'll give that a go next.

Thanks,
b

On Feb 6, 2:09 pm, Aaron Fay <[EMAIL PROTECTED]> wrote:
> Brandon,
> I just realized also, from your original error:EnvironmentError: Could not 
> import settings 'testproject.settings' (Is it on sys.path?Does it have syntax 
> errors?): No module named testproject.settings.Does it have syntax errors?
> Aaron
> Aaron Fay wrote:Hey Brandon,
> Here's my exact setup:
> 
> SetHandler python-program
> PythonPath "['C:\django'] + sys.path"
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> PythonDebug On
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
> "testproject" is here "C:\django\testproject", settings file is 
> "C:\django\testproject\settings.py".  I put both 
> "C:\Python25\Scripts;c:\Python25\" in my system PATH.
> Running an XP SP2 box, wamp5 version 1.6.4, Apache 2.0.58(win32), mod_python 
> 3.3.1, Python 2.5.1
> Don't know if there's anything else I can tell you that might help, good luck 
> with it...
> Aaron
> Brandon Taylor wrote:Hi Guys, Yes, I've tried that as well. No dice. Ugh! b 
> On Feb 6, 1:22 pm, Michael Hipp<[EMAIL PROTECTED]>wrote:Is there a reason 
> this line looks like this: >  Instead of like this: 
> >  Michael Brandon Taylor wrote:Well, still no working 
> solution, but here is my httpd.config now: 
> SetHandler python-program PythonPath "['C:/django_projects/', 
> 'C:/Python25/lib/site-packages/ django'] + sys.path" PythonHandler 
> django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE 
> testproject.settings PythonDebug On I'm wondering if I should move 
> to a FastCGI setup versus mod_python, as that's how my shared environment is 
> going to be configured.Thoughts anyone? I don't understand what the problem 
> might be here. I'll see if I have any more luck on my Mac when I get home.- 
> Brandon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new to django

2008-02-06 Thread [EMAIL PROTECTED]

Don't forget to add 'django.contrib.admin' to INSTALLED_APPS in your
settings.py
after that, run  python manage.py syncdb from your root project
folder.
that creates necessary table 'django_admin_log' on your database.


On Feb 6, 4:08 pm, "Beema shafreen" <[EMAIL PROTECTED]> wrote:
> Hi everybody i am new to django,
>
> I am trying to create my own project using django,
>
> I have a got an error when in logged in with the password and user name
>
> the error is
> Request Method: GET  Request URL:http://192.168.5.26:8000/admin/ Exception
> Type: ProgrammingError  Exception Value: (1146, "Table '
> genemass.django_admin_log' doesn't exist")  Exception Location:
> /var/lib/python-support/python2.4/MySQLdb/connections.py
> in defaulterrorhandler, line 35
> can some one suggest me what is the  error. how should i correct it
>
> An  another  problem i am facing is using the forms  says for  example  in
> the chapter  7 they have given  in forms  book/search.html  where should
> this search .html be actually stored.
>
> Regards
>
> shafreen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to organize a django website

2008-02-06 Thread Anton Kovalyov

Hi Brandon,

Brandon Taylor wrote:
> Hello everyone,
> 
> I'm just getting started, so please bear with me. How should I
> organize my website? 

In our project, we use a little bit different source code organization:

/
|-- apps/
| |-- app1/
| |-- app2/
| |-- ...
| |-- special_app/ (special app for common template tags)
|
|-- templates/
| |-- app1/
| |-- app2/
| |-- ...
|
|-- static/
| |-- component1/ (.js and .css files)
|   |-- images/
| |-- component2/
|   |-- images/
| |-- ...
|-- lib/
|-- (various files like settings.py, urls.py)

Some notes:
  * settings.py includes only common (and default) settings.
All personalized data (like db access credentials) is in
the .mysettings.py file that is accessed from the settings.py
  * main urls.py simply includes local applications' urls
from apps/app_name/urls.py
  * static/ directory is not served by django
  * lib/ contains special classes and functions we use
(like text splitter class, useful decorators, etc.)
  * initially, we had a different tree under static/ directory.
It was as simple as /images, /stylesheets and /javascripts. But
then we had to reorganize our code and change this directory
accordingly.
  * and our code is not in the website root.

Of course, I can't say that our (or somebody's else) source code 
organization is the best because it is not. And, I guess, our current 
tree is not final even for this particular project I am involved in.

Anton

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



Re: [newbie]Apache Deployment Problem

2008-02-06 Thread Karen Tracey
On Feb 6, 2008 2:16 PM, Tony Winslow <[EMAIL PROTECTED]> wrote:

>
> Karen Tracey wrote:
> > On Feb 6, 2008 9:11 AM, Tony Winslow <[EMAIL PROTECTED]
> > > wrote:
> >
> > Hi, all!
> > I installed mod_python and do the configurations as the tutorial
> > on the
> > official site. But mod_python still can not find the mysite.settings
> > module. What might be the problem?
> >
> >
> > Could be apache doesn't have permissions to access your settings file,
> > could be you didn't quite get the config right. If you post details of
> > how you have set things up people would be more likely to be able to
> > spot what the problem is.
> >
> > Karen
> >
> >
> > >
> I set the path to include /path/to/mysite and /var/www.
> My App is under /path/to/mysite, and settings.py is at /var/www/mysite
> which is accessible to Apache.
>

Your settings.py file is in a different directory tree than the rest of your
code?  That seems a little odd, though I don't know that it would cause any
problems.  What have you set DJANGO_SETTINGS_MODULE to?  From the trace it
looks like it might just be 'settings', where it needs to be '
mysite.settings', since you did not include the 'mysite' part of
/var/www/mysite/settings.py in the Python path.

Karen


>
> The traceback:
>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1537, in HandlerDispatch
>default=default_handler, arg=req, silent=hlist.silent)
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1229, in _process_target
>result = _execute_target(config, req, object, arg)
>
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1128, in _execute_target
>result = object(arg)
>
>  File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line
> 177, in handler
>return ModPythonHandler()(req)
>
>  File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line
> 145, in __call__
>self.load_middleware()
>
>  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py",
> line 22, in load_middleware
>for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 28,
> in __getattr__
>self._import_settings()
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 55,
> in _import_settings
>self._target = Settings(settings_module)
>
>  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 83,
> in __init__
>raise EnvironmentError, "Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
>
> EnvironmentError: Could not import settings 'settings' (Is it on sys.path?
> Does it have syntax errors?): No module named settings
>
>
>
> >
>

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



Re: User login form

2008-02-06 Thread eraoul

Sorry if I'm a pest... but does anybody out there have any idea how to
do logins? I can write my own newforms login form... no problem. But
how do I hook it up to django's own authentication view in
django.contrib.auth.views? That code seems to use an oldforms
UserAuthentication form, which isn't a form at all, but a validator.

This all seems surprisingly confusing and when I try to write my
own form, I get funny, weird behavior; if I login, then logout, and
then login again, the user is actually authenticated again, but the
django.contrib.auth.views.login code (I believe) is redirecting to the
login page an extra time.

Any takers? I found a thing on django snippets for login, but it seems
to be for an older version, and does its own login instead of using
the django contrib.auth login view.

Is it possible to both
1) write my own login form (because no built-in login form exists in
django), and
2) use my form with the built in django login view?

If not, can someone show me how to use the built in login view, if it
can't be used with a custom form?

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



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Aaron Fay





Brandon,

I just realized also, from your original error:
EnvironmentError: Could not import settings 'testproject.settings' (Is
it on sys.path? Does it have syntax errors?): No module named
testproject.settings.
Does it have syntax errors?
Aaron

Aaron Fay wrote:

  
Hey Brandon, 
  
Here's my exact setup:
  
      
        SetHandler python-program 
        PythonPath "['C:\django'] + sys.path" 
        PythonHandler django.core.handlers.modpython 
        SetEnv DJANGO_SETTINGS_MODULE testproject.settings 
        PythonDebug On 
     
      
        SetHandler None 
     
      
        SetHandler None 
    
  
"testproject" is here "C:\django\testproject", settings file is
"C:\django\testproject\settings.py".  I put both
"C:\Python25\Scripts;c:\Python25\" in my system PATH.
  
Running an XP SP2 box, wamp5 version 1.6.4, Apache 2.0.58(win32),
mod_python 3.3.1, Python 2.5.1
  
Don't know if there's anything else I can tell you that might help,
good luck with it...
Aaron
  
  
  
Brandon Taylor wrote:
  
Hi Guys,

Yes, I've tried that as well. No dice. Ugh!

b

On Feb 6, 1:22 pm, Michael Hipp <[EMAIL PROTECTED]> wrote:
  

  Is there a reason this line looks like this:
> 

Instead of like this:
> 

Michael

Brandon Taylor wrote:

  
Well, still no working solution, but here is my httpd.config now:
  
  
  

SetHandler python-program
PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonDebug On

  
  
  
I'm wondering if I should move to a FastCGI setup versus mod_python,
as that's how my shared environment is going to be configured.
  
  
  
Thoughts anyone? I don't understand what the problem might be here.
I'll see if I have any more luck on my Mac when I get home.
  
  
  
- Brandon
  
  



  
  
  
  


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






Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Aaron Fay





Hey Brandon, 

Here's my exact setup:

      
        SetHandler python-program 
        PythonPath "['C:\django'] + sys.path" 
        PythonHandler django.core.handlers.modpython 
        SetEnv DJANGO_SETTINGS_MODULE testproject.settings 
        PythonDebug On 
     
      
        SetHandler None 
     
      
        SetHandler None 
    

"testproject" is here "C:\django\testproject", settings file is
"C:\django\testproject\settings.py".  I put both
"C:\Python25\Scripts;c:\Python25\" in my system PATH.

Running an XP SP2 box, wamp5 version 1.6.4, Apache 2.0.58(win32),
mod_python 3.3.1, Python 2.5.1

Don't know if there's anything else I can tell you that might help,
good luck with it...
Aaron



Brandon Taylor wrote:

  Hi Guys,

Yes, I've tried that as well. No dice. Ugh!

b

On Feb 6, 1:22 pm, Michael Hipp <[EMAIL PROTECTED]> wrote:
  
  
Is there a reason this line looks like this:
> 

Instead of like this:
> 

Michael

Brandon Taylor wrote:


  Well, still no working solution, but here is my httpd.config now:
  


  
SetHandler python-program
PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonDebug On

  


  I'm wondering if I should move to a FastCGI setup versus mod_python,
as that's how my shared environment is going to be configured.
  


  Thoughts anyone? I don't understand what the problem might be here.
I'll see if I have any more luck on my Mac when I get home.
  


  - Brandon
  

  
  

  


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






Re: OneToOne Relationships

2008-02-06 Thread Vance Dubberly

Thanks that makes more sense than the current implementation.  I hope
that using ForeignKey for the current relationships now will allow me
to update the with unique=True later ( of course realizing that I'll
have to play with how I access the ForeignKey).

Vance

On Feb 5, 2008 6:10 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
> On Tue, 2008-02-05 at 17:51 -0800, Vance Dubberly wrote:
> > The Documentation has said for as long as I can remember (a year+)
> > that the semantics of a the OneToOne relationship is going to change
> > soon.  Any clue as to when this is going to change
>
> Soon.
>
> > and/or what it's
> > going to look like?
>
> It will look behave like ForeignKey(unique=True), except that a reverse
> lookup will return the object on the reverse of the relation, not a list
> containing one object (reverse lookups on ForeignKeys always return a
> list, since it's one-to-many and we shouldn't change the return type
> just because of the unique flag there).
>
> Also, the restriction that OneToOneFields are implicitly primary keys
> will be removed, since there are cases where multiple one-to-one
> relations in a model are required.
>
> Malcolm
>
> --
> I don't have a solution, but I admire your problem.
> http://www.pointy-stick.com/blog/
>
>
> >
>



-- 
To pretend, I actually do the thing: I have therefore only pretended to pretend.
  - Jacques Derrida

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



Re: {% load %} tag in a base template can't be inherited?

2008-02-06 Thread Adam Stein

On Wed, 2008-02-06 at 11:31 -0800, Daniel Roseman wrote:
> >From the same documentation page you quote above (http://
> www.djangoproject.com/documentation/templates/):
> 
> When you load a custom tag or filter library, the tags/filters are
> only made available to the current template -- not any parent or child
> templates along the template-inheritance path.
> For example, if a template foo.html has {% load comments %}, a child
> template (e.g., one that has {% extends "foo.html" %}) will not have
> access to the comments template tags and filters. The child template
> is responsible for its own {% load comments %}.
> This is a feature for the sake of maintainability and sanity.

Thanks for the info.  At least I know I'm not missing something.  It
does seem to interfere with DRY since I have to repeat {% load %} (in my
case, there are 2) in each child template.

> RE the extends tag placement, this is a recent change in the trunk
> (there's a thread talking about it in django-developers now). You're
> looking at the SVN documentation but using 0.96 - you might be better
> off following the link at the top of the page to the 0.96
> documentation.

I took the quote from the v0.96 doc
(http://www.djangoproject.com/documentation/0.96/templates/).
-- 
Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]

Disclaimer: All views expressed 
here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]


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



Re: {% load %} tag in a base template can't be inherited?

2008-02-06 Thread Daniel Roseman

On 6 Feb, 19:03, Adam Stein <[EMAIL PROTECTED]> wrote:
> Running Django v0.96.
>
> Want to check to see if this behavior is normal.  I have a base template
> that uses {% load %}.  I have another template that extends the base
> template.  The {% load %} tag doesn't seem to carry into the extended
> template.  In other words, it looks like I have to use {% load %} in
> every single extended template, not just declare it once in the base.
> To give a concrete example:
>
> --base.html--
>
> {% load mytags %}
>
> {% mytitle "My Title Tag" %}
>
> --base.html--
>
> --derived.html--
>
> {% extends "base.html" %}
>
> {% mytitle "My Title Tag in the Derived" %}
>
> --derived.html--
>
> Using 'base.html' calls 'mytitle' just fine.  Using 'derived.html' does
> not.
>
> On a related note, the docs say:
>
> If you use {% extends %} in a template, it must be the first
> template tag in that template. Template inheritance won't work,
> otherwise.
>
> This isn't true unless {% load %} doesn't count as a template tag.  My
> derived templates work if I put {% extends %} first or {% load %} first.
> --
> Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]
>
> Disclaimer: All views expressed
> here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]

>From the same documentation page you quote above (http://
www.djangoproject.com/documentation/templates/):

When you load a custom tag or filter library, the tags/filters are
only made available to the current template -- not any parent or child
templates along the template-inheritance path.
For example, if a template foo.html has {% load comments %}, a child
template (e.g., one that has {% extends "foo.html" %}) will not have
access to the comments template tags and filters. The child template
is responsible for its own {% load comments %}.
This is a feature for the sake of maintainability and sanity.


RE the extends tag placement, this is a recent change in the trunk
(there's a thread talking about it in django-developers now). You're
looking at the SVN documentation but using 0.96 - you might be better
off following the link at the top of the page to the 0.96
documentation.
--
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Brandon Taylor

Hi Guys,

Yes, I've tried that as well. No dice. Ugh!

b

On Feb 6, 1:22 pm, Michael Hipp <[EMAIL PROTECTED]> wrote:
> Is there a reason this line looks like this:
> > 
>
> Instead of like this:
> > 
>
> Michael
>
> Brandon Taylor wrote:
> > Well, still no working solution, but here is my httpd.config now:
>
> > 
> > SetHandler python-program
> > PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
> > django'] + sys.path"
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > PythonDebug On
> > 
>
> > I'm wondering if I should move to a FastCGI setup versus mod_python,
> > as that's how my shared environment is going to be configured.
>
> > Thoughts anyone? I don't understand what the problem might be here.
> > I'll see if I have any more luck on my Mac when I get home.
>
> > - Brandon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Michael Hipp

Is there a reason this line looks like this:
> 

Instead of like this:
> 

Michael

Brandon Taylor wrote:
> Well, still no working solution, but here is my httpd.config now:
> 
> 
> SetHandler python-program
> PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
> django'] + sys.path"
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> PythonDebug On
> 
> 
> I'm wondering if I should move to a FastCGI setup versus mod_python,
> as that's how my shared environment is going to be configured.
> 
> Thoughts anyone? I don't understand what the problem might be here.
> I'll see if I have any more luck on my Mac when I get home.
> 
> - Brandon

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



RE: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Matt Vickers
Try changing  to 

Django's probably looking for testproject.testproject.settings

M.


-Original Message-
From: django-users@googlegroups.com on behalf of Brandon Taylor
Sent: Thu 2/7/2008 8:16 a.m.
To: Django users
Subject: Re: Setting up Apache & mod_python on my development computer
 

Well, still no working solution, but here is my httpd.config now:


SetHandler python-program
PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonDebug On


I'm wondering if I should move to a FastCGI setup versus mod_python,
as that's how my shared environment is going to be configured.

Thoughts anyone? I don't understand what the problem might be here.
I'll see if I have any more luck on my Mac when I get home.

- Brandon


On Feb 6, 11:13 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi Aaron,
>
> I'm still getting the same error after I restart Apache. Is there a
> better setup to use for the install location for Django and where I
> place my projects that plays nice with Apache?
>
> Thanks,
> Brandon
>
> On Feb 6, 11:05 am, Aaron Fay <[EMAIL PROTECTED]> wrote:
>
> > Hey Brandon,
>
> > I have mine working on the same rig as you (looks like).  Here's a shot
> > in the dark:
>
> >  # << add forward slash
> > SetHandler python-program
> > PythonPath "['C:/django_projects/'] + sys.path" # << remove 
> > 'testproject'
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > PythonInterpreter testproject # << I don't have this line in my config, 
> > maybe try commenting it out
> > PythonDebug On
> > 
>
> > I'm guessing your error comes from django looking for the settings
> > module in /django_projects/testproject/testproject/
>
> > Like I said, shot in the dark, but hth...
> > Aaron
>
> > Brandon Taylor wrote:
> > > Hi everyone,
>
> > > I have Apache 2 and mod_python installed on Windows. The mod_python
> > > module is loaded and active.
>
> > > Here's a breakdown of where things are...
>
> > > Python is installed at: C:\Python25
> > > Django is installed at: C:\Python25\Lib\site-packages
> > > \django
> > > My 'testproject' in installed at: C:\django_projects\testproject
>
> > > I have the following entry for 'testproject' in my Apache httpd.conf:
>
> > > 
> > > SetHandler python-program
> > > PythonPath "['C:/django_projects/testproject'] + sys.path"
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > > PythonInterpreter testproject
> > > PythonDebug On
> > > 
>
> > > When I hit:http://localhost/testproject, I receive the following
> > > error:
>
> > > EnvironmentError: Could not import settings 'testproject.settings' (Is
> > > it on sys.path? Does it have syntax errors?): No module named
> > > testproject.settings.
>
> > > When I use the command line and start the built-in server for the
> > > project, it will run and I get the Django welcome page. I added an
> > > environment variable called PYTHONPATH and pointed it to C:
> > > \django_projects, but I still get the error.
>
> > > Can anyone point me in the right direction? I'd really like to be able
> > > to test in an Apache/mod_python environment versus the built-in
> > > server, as that is how my shared hosting provider is configured and
> > > I'd like to avoid surprises.
>
> > > TIA,
> > > Brandon


Scanned by Bizo Email Filter



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

<>

Re: [newbie]Apache Deployment Problem

2008-02-06 Thread Tony Winslow

Karen Tracey wrote:
> On Feb 6, 2008 9:11 AM, Tony Winslow <[EMAIL PROTECTED] 
> > wrote:
>
> Hi, all!
> I installed mod_python and do the configurations as the tutorial
> on the
> official site. But mod_python still can not find the mysite.settings
> module. What might be the problem?
>
>
> Could be apache doesn't have permissions to access your settings file, 
> could be you didn't quite get the config right. If you post details of 
> how you have set things up people would be more likely to be able to 
> spot what the problem is.
>
> Karen
>
>
> >
I set the path to include /path/to/mysite and /var/www.
My App is under /path/to/mysite, and settings.py is at /var/www/mysite 
which is accessible to Apache.

The traceback:

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in 
HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in 
_process_target
result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in 
_execute_target
result = object(arg)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", 
line 177, in handler
return ModPythonHandler()(req)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", 
line 145, in __call__
self.load_middleware()

  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 
22, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 28, in 
__getattr__
self._import_settings()

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 55, in 
_import_settings
self._target = Settings(settings_module)

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 83, in 
__init__
raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? 
Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)

EnvironmentError: Could not import settings 'settings' (Is it on sys.path? Does 
it have syntax errors?): No module named settings



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



Specifying custom upload to with FileField

2008-02-06 Thread shabda

I have a model like

class ProjectFile(models.Model):
project = models.ForeignKey(Project)
file = models.FileField(upload_to = '/files/')

class Project(models.Model):
  name = models.CharField(max_length  = 100)

With this the uploaded files will go to <>/files/,
howeverI want to upload all files to a subdirectory with the name of
the project, how can I do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Brandon Taylor

Well, still no working solution, but here is my httpd.config now:


SetHandler python-program
PythonPath "['C:/django_projects/', 'C:/Python25/lib/site-packages/
django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonDebug On


I'm wondering if I should move to a FastCGI setup versus mod_python,
as that's how my shared environment is going to be configured.

Thoughts anyone? I don't understand what the problem might be here.
I'll see if I have any more luck on my Mac when I get home.

- Brandon


On Feb 6, 11:13 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi Aaron,
>
> I'm still getting the same error after I restart Apache. Is there a
> better setup to use for the install location for Django and where I
> place my projects that plays nice with Apache?
>
> Thanks,
> Brandon
>
> On Feb 6, 11:05 am, Aaron Fay <[EMAIL PROTECTED]> wrote:
>
> > Hey Brandon,
>
> > I have mine working on the same rig as you (looks like).  Here's a shot
> > in the dark:
>
> >  # << add forward slash
> > SetHandler python-program
> > PythonPath "['C:/django_projects/'] + sys.path" # << remove 
> > 'testproject'
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > PythonInterpreter testproject # << I don't have this line in my config, 
> > maybe try commenting it out
> > PythonDebug On
> > 
>
> > I'm guessing your error comes from django looking for the settings
> > module in /django_projects/testproject/testproject/
>
> > Like I said, shot in the dark, but hth...
> > Aaron
>
> > Brandon Taylor wrote:
> > > Hi everyone,
>
> > > I have Apache 2 and mod_python installed on Windows. The mod_python
> > > module is loaded and active.
>
> > > Here's a breakdown of where things are...
>
> > > Python is installed at: C:\Python25
> > > Django is installed at: C:\Python25\Lib\site-packages
> > > \django
> > > My 'testproject' in installed at: C:\django_projects\testproject
>
> > > I have the following entry for 'testproject' in my Apache httpd.conf:
>
> > > 
> > > SetHandler python-program
> > > PythonPath "['C:/django_projects/testproject'] + sys.path"
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > > PythonInterpreter testproject
> > > PythonDebug On
> > > 
>
> > > When I hit:http://localhost/testproject, I receive the following
> > > error:
>
> > > EnvironmentError: Could not import settings 'testproject.settings' (Is
> > > it on sys.path? Does it have syntax errors?): No module named
> > > testproject.settings.
>
> > > When I use the command line and start the built-in server for the
> > > project, it will run and I get the Django welcome page. I added an
> > > environment variable called PYTHONPATH and pointed it to C:
> > > \django_projects, but I still get the error.
>
> > > Can anyone point me in the right direction? I'd really like to be able
> > > to test in an Apache/mod_python environment versus the built-in
> > > server, as that is how my shared hosting provider is configured and
> > > I'd like to avoid surprises.
>
> > > TIA,
> > > Brandon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



{% load %} tag in a base template can't be inherited?

2008-02-06 Thread Adam Stein

Running Django v0.96.

Want to check to see if this behavior is normal.  I have a base template
that uses {% load %}.  I have another template that extends the base
template.  The {% load %} tag doesn't seem to carry into the extended
template.  In other words, it looks like I have to use {% load %} in
every single extended template, not just declare it once in the base.
To give a concrete example:

--base.html--

{% load mytags %}

{% mytitle "My Title Tag" %}

--base.html--

--derived.html--

{% extends "base.html" %}

{% mytitle "My Title Tag in the Derived" %}

--derived.html--

Using 'base.html' calls 'mytitle' just fine.  Using 'derived.html' does
not.

On a related note, the docs say:

If you use {% extends %} in a template, it must be the first
template tag in that template. Template inheritance won’t work,
otherwise.

This isn't true unless {% load %} doesn't count as a template tag.  My
derived templates work if I put {% extends %} first or {% load %} first.
-- 
Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]

Disclaimer: All views expressed 
here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]


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



Re: Template tag parameter

2008-02-06 Thread Rajesh Dhawan



On Feb 5, 7:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I've made a tag with I want to call with a function name and parameter
> like this:
>
>  {% tag "delete_wiki_entry" "Delete" "Are you sure you want to delete
> this wikiboard entry?" "delete_wikientry({{entry.name}})" %
>
> {{entry.name}} doesn't get replaced by the correct value, how can I do
> this? Is it possible?

Yes. You could revise your tag to accept parameters in this format:

{% tag "delete_wiki_entry" "Delete" "Are you sure you want to delete
this wikiboard entry?" "delete_wikientry(%s)" entry.name %}

Now, in your tag's Python code, you can merge the last two parameters
like this:

merged_param = p4 % p5

The key is to pass entry.name as above (without quotes or braces).
Django's template infrastructure will resolve it for you.

-Rajesh D



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



Re: User permissions

2008-02-06 Thread James Bennett

On Feb 6, 2008 11:57 AM, Erwin <[EMAIL PROTECTED]> wrote:
> That sounds quite interesting, but I'm not totally sure what you are
> referring to. Do you mean the hooks the newforms admin branch provides
> or maybe the possibilities of the row-level permissions branch?

newforms-admin.

row-level-permissions is, as far as I can tell, made obsolete by
newforms-admin -- adding a complex syntax for object-level permissions
is moot when you have the stuff newforms-admin provides.

> How long does will it take is from now to the not-too-distant future?

Some amount of time between "now" and "the heat death of the
universe". There is no estimate, no timeline, no schedule, no ETA, no
guess, nor any other synonym of any of those words.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: User permissions

2008-02-06 Thread Erwin

> In the admin it's basically not possible right now, but will become
> very easy in the not-too-distant future.

That sounds quite interesting, but I'm not totally sure what you are
referring to. Do you mean the hooks the newforms admin branch provides
or maybe the possibilities of the row-level permissions branch?

(The progress of the latter is quite unclear to me, besides some
remarks on this group about postponing it, untill after newforms admin
branch is finished.
http://groups.google.com/group/django-users/browse_thread/thread/630713d903dec1d2/ac8761d863ac9adb#ac8761d863ac9adb)

How long does will it take is from now to the not-too-distant future?
Hopefully you really have some good news for me :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: [newbie]Apache Deployment Problem

2008-02-06 Thread Karen Tracey
On Feb 6, 2008 9:11 AM, Tony Winslow <[EMAIL PROTECTED]> wrote:

> Hi, all!
> I installed mod_python and do the configurations as the tutorial on the
> official site. But mod_python still can not find the mysite.settings
> module. What might be the problem?


Could be apache doesn't have permissions to access your settings file, could
be you didn't quite get the config right. If you post details of how you
have set things up people would be more likely to be able to spot what the
problem is.

Karen

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



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Brandon Taylor

Hi Aaron,

I'm still getting the same error after I restart Apache. Is there a
better setup to use for the install location for Django and where I
place my projects that plays nice with Apache?

Thanks,
Brandon

On Feb 6, 11:05 am, Aaron Fay <[EMAIL PROTECTED]> wrote:
> Hey Brandon,
>
> I have mine working on the same rig as you (looks like).  Here's a shot
> in the dark:
>
>  # << add forward slash
> SetHandler python-program
> PythonPath "['C:/django_projects/'] + sys.path" # << remove 'testproject'
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> PythonInterpreter testproject # << I don't have this line in my config, 
> maybe try commenting it out
> PythonDebug On
> 
>
> I'm guessing your error comes from django looking for the settings
> module in /django_projects/testproject/testproject/
>
> Like I said, shot in the dark, but hth...
> Aaron
>
> Brandon Taylor wrote:
> > Hi everyone,
>
> > I have Apache 2 and mod_python installed on Windows. The mod_python
> > module is loaded and active.
>
> > Here's a breakdown of where things are...
>
> > Python is installed at: C:\Python25
> > Django is installed at: C:\Python25\Lib\site-packages
> > \django
> > My 'testproject' in installed at: C:\django_projects\testproject
>
> > I have the following entry for 'testproject' in my Apache httpd.conf:
>
> > 
> > SetHandler python-program
> > PythonPath "['C:/django_projects/testproject'] + sys.path"
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> > PythonInterpreter testproject
> > PythonDebug On
> > 
>
> > When I hit:http://localhost/testproject, I receive the following
> > error:
>
> > EnvironmentError: Could not import settings 'testproject.settings' (Is
> > it on sys.path? Does it have syntax errors?): No module named
> > testproject.settings.
>
> > When I use the command line and start the built-in server for the
> > project, it will run and I get the Django welcome page. I added an
> > environment variable called PYTHONPATH and pointed it to C:
> > \django_projects, but I still get the error.
>
> > Can anyone point me in the right direction? I'd really like to be able
> > to test in an Apache/mod_python environment versus the built-in
> > server, as that is how my shared hosting provider is configured and
> > I'd like to avoid surprises.
>
> > TIA,
> > Brandon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Jonathan Ballet

Hi,

Brandon Taylor wrote:
> 
> SetHandler python-program
> PythonPath "['C:/django_projects/testproject'] + sys.path"
 > [...]

Try :

PythonPath "['C:/django_projects/'] + sys.path"

instead, since "testproject" is the subdirectory where you project lives in.

Maybe changing the DJANGO_SETTINGS_MODULE environment variable to "settings" 
would have done the 
same, but I think it's less clear that way.

> When I use the command line and start the built-in server for the
> project, it will run and I get the Django welcome page. I added an
> environment variable called PYTHONPATH and pointed it to C:
> \django_projects, but I still get the error.

It should have fixed the problem, but I don't know how Apache takes environment 
variables into account.


Hope it helps,
  - Jonathan

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



Re: Setting up Apache & mod_python on my development computer

2008-02-06 Thread Aaron Fay

Hey Brandon,

I have mine working on the same rig as you (looks like).  Here's a shot 
in the dark:

 # << add forward slash
SetHandler python-program
PythonPath "['C:/django_projects/'] + sys.path" # << remove 'testproject'
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonInterpreter testproject # << I don't have this line in my config, 
maybe try commenting it out
PythonDebug On


I'm guessing your error comes from django looking for the settings 
module in /django_projects/testproject/testproject/

Like I said, shot in the dark, but hth...
Aaron

Brandon Taylor wrote:
> Hi everyone,
>
> I have Apache 2 and mod_python installed on Windows. The mod_python
> module is loaded and active.
>
> Here's a breakdown of where things are...
>
> Python is installed at: C:\Python25
> Django is installed at: C:\Python25\Lib\site-packages
> \django
> My 'testproject' in installed at: C:\django_projects\testproject
>
> I have the following entry for 'testproject' in my Apache httpd.conf:
>
> 
> SetHandler python-program
> PythonPath "['C:/django_projects/testproject'] + sys.path"
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE testproject.settings
> PythonInterpreter testproject
> PythonDebug On
> 
>
> When I hit: http://localhost/testproject, I receive the following
> error:
>
> EnvironmentError: Could not import settings 'testproject.settings' (Is
> it on sys.path? Does it have syntax errors?): No module named
> testproject.settings.
>
> When I use the command line and start the built-in server for the
> project, it will run and I get the Django welcome page. I added an
> environment variable called PYTHONPATH and pointed it to C:
> \django_projects, but I still get the error.
>
> Can anyone point me in the right direction? I'd really like to be able
> to test in an Apache/mod_python environment versus the built-in
> server, as that is how my shared hosting provider is configured and
> I'd like to avoid surprises.
>
> TIA,
> Brandon
> >
>
>   


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



Setting up Apache & mod_python on my development computer

2008-02-06 Thread Brandon Taylor

Hi everyone,

I have Apache 2 and mod_python installed on Windows. The mod_python
module is loaded and active.

Here's a breakdown of where things are...

Python is installed at: C:\Python25
Django is installed at: C:\Python25\Lib\site-packages
\django
My 'testproject' in installed at: C:\django_projects\testproject

I have the following entry for 'testproject' in my Apache httpd.conf:


SetHandler python-program
PythonPath "['C:/django_projects/testproject'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonInterpreter testproject
PythonDebug On


When I hit: http://localhost/testproject, I receive the following
error:

EnvironmentError: Could not import settings 'testproject.settings' (Is
it on sys.path? Does it have syntax errors?): No module named
testproject.settings.

When I use the command line and start the built-in server for the
project, it will run and I get the Django welcome page. I added an
environment variable called PYTHONPATH and pointed it to C:
\django_projects, but I still get the error.

Can anyone point me in the right direction? I'd really like to be able
to test in an Apache/mod_python environment versus the built-in
server, as that is how my shared hosting provider is configured and
I'd like to avoid surprises.

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



template & forloop help

2008-02-06 Thread leahy_rich

Hi guys,

Trying to figure out how to use the forloop.counter in a template but
to add it to a field to increment the name of the field each time. for
example.. in my template i will have this

{% for div in divs %}
{{ form.name }}
{% endfor %}

so this will result in ...

name
name
name etc..

I need it to be name1, name2 , name3

I was thinking of something like this although this does not work. is
there a way of using the %s %i in a template?

{% for div in divs %}
{{ form.name|forloop.counter }}
{% endfor %}

If i just did it manualy like below it works fine

{% for div in divs %}

{% endfor %}

Any help 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



overriding (or validating) model field attribute setting?

2008-02-06 Thread mtrumpler

I'm relatively new to Django, so please be gentle. :)

I'm trying to implement an http credential management module.
Something along the lines of Firefox's password management, that
stores (host,realm,user,password) in one model for use in http
requests.  The passwords are encrypted using an encryption key, which
is stored in another model, along with a password hash of a user-
supplied password:

class AuthManager(models.Model):
masterPasswordHash = CharField(max_length=300) # contains hash of
user password
encryptionKey = CharField(max_length=300) # encryption key,
encrypted with user password

This model has methods for "unlocking", which store the decrypted
encryption key for use in accessing
the encrypted http passwords.  This decrypted key can be erased
according to policy, after which time
the user must re-enter the master password to use the password
manager.

I would like to make sure that these fields are not easily
changeable.  Right now, I can start up a shell and do something like:

  mgr = AuthManager.objects.all()[0]
  mgr.masterPasswordHash = 'a new hash'
  mgr.save()

Ideally, the only way to change these fields would be through a method
in the AuthManager that makes sure it is unlocked before changing the
password (which really requires changing both fields at once).
Attempts to set them directly from outside the class should probably
raise exceptions.

What's the best way to accomplish this?  I tried subclassing CharField
and overriding __set__, this didn't work.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: filtering foreign key

2008-02-06 Thread [EMAIL PROTECTED]

Thanks Rajesh. I actually found it about 2 minutes after I posted.
That's it.

On Feb 6, 8:50 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Feb 6, 9:40 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I'm sure this is a common case and the answer is readily available
> > somewhere, but I can't seem to find it.
>
> > In a model, I've got:
> >     author = models.ForeignKey(User, related_name="article_author")
>
> > But I don't want to get all Users, I want to filter for Is_staff and
> > only show staff users.
>
> I am assuming you want this behaviour in the Admin. If so, try this:
>
> author = models.ForeignKey(User, related_name="article_author",
> limit_choices_to={'is_staff':True})
>
> http://www.djangoproject.com/documentation/model-api/#many-to-one-rel...
>
> -RD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Improperly configured exception

2008-02-06 Thread Schmoopie

I looked into this. mysite.urls exists, no syntax errors, but it seems
that when it tries to import from a models.py file, it goes looking
for that file in a completely different directory, which in fact no
longer exists. Weird.

Is this an environment variable problem? Why would it go looking for
the models file on some distant path?

On Feb 5, 11:24 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]>
wrote:
> On 2/5/08, Schmoopie <[EMAIL PROTECTED]> wrote:
>
> > Improperly configured
> > Error while importing URLconf 'mysite.urls'
>
> > but there is no explanation here as to what is wrong with the
> > configuration. What could be causing this?
>
> It probably means that your ROOT_URLCONF, `mysite.urls`, is missing or
> has a syntax error. Try importing it from the shell:
>
> $ ./manage.py shell
>
> >>> import mysite.urls
>
> And see what happens. That should show you the error.
>
> Jacob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: filtering foreign key

2008-02-06 Thread Rajesh Dhawan

On Feb 6, 9:40 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I'm sure this is a common case and the answer is readily available
> somewhere, but I can't seem to find it.
>
> In a model, I've got:
> author = models.ForeignKey(User, related_name="article_author")
>
> But I don't want to get all Users, I want to filter for Is_staff and
> only show staff users.

I am assuming you want this behaviour in the Admin. If so, try this:

author = models.ForeignKey(User, related_name="article_author",
limit_choices_to={'is_staff':True})

http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships

-RD

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



Re: How to organize a django website

2008-02-06 Thread Brandon Taylor

Thanks guys! I'm about halfway through the Definitive Guide book, and
I like what I've seen so far. I'll just have to dig in, and start
coding. I've seen quite a few posts about how to organize a "typical"
website, so after I get one working I'll post an overview of what I
did and where I put things for other n00bs like me :)

Cheers,
Brandon

On Feb 6, 8:31 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Brandon,
>
> For additional insight on this topic, you might want to check out this
> entry from James Bennett's fantastic blog, The B-List:
>
> http://www.b-list.org/weblog/2006/sep/10/django-tips-laying-out-appli...
>
> -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AssertionError on a model

2008-02-06 Thread Rajesh Dhawan



On Feb 6, 8:27 am, Nader <[EMAIL PROTECTED]> wrote:
> Thank you for this conceptual remark.
> Could the "ForeignKey" filed be a "primary_key at the same time?

No. And that's the source of the problem you are seeing. If you just
want the ForeignKey to be unique, you can add a unique=True attribute
on it instead of primary_key=True.

>  I suppose I can define a group of fields as "primary_key" by using of
> the next statement :
>
>   unique_together = (("datasetID", "filename", "fileVersion"),)

Yes, use unique_together to declare that a group of fields are
together a set of unique values. But let Django create an id field as
an implicit primary key to keep things simple (or define another field
as the PK that's not a ForeignKey or ManyToMany etc.)

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



filtering foreign key

2008-02-06 Thread [EMAIL PROTECTED]

I'm sure this is a common case and the answer is readily available
somewhere, but I can't seem to find it.

In a model, I've got:
author = models.ForeignKey(User, related_name="article_author")

But I don't want to get all Users, I want to filter for Is_staff and
only show staff users.

Like I said, I know I can't be the only one who's run into this, so if
anyone wants to just give me the "duh, look here" link, that's fine.
I've searched google, the docs and here and haven't found 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to organize a django website

2008-02-06 Thread Rajesh Dhawan

Hi Brandon,

For additional insight on this topic, you might want to check out this
entry from James Bennett's fantastic blog, The B-List:

http://www.b-list.org/weblog/2006/sep/10/django-tips-laying-out-application/

-Rajesh D

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



Re: How to organize a django website

2008-02-06 Thread prz

Daniel Roseman wrote:
>
> On Feb 6, 1:17 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>   
>> Hello everyone,
>>
>> I'm just getting started, so please bear with me. How should I
>> organize my website? I haven't seen a definitive example of where to
>> put settings files, templates, applications, images, stylesheets, etc.
>>
>> My best guess would be something like:
>>
>> /website_root
>>   /source
>> settings.py
>> urls.py
>> __init__.py
>>
>>   /templates
>> /images
>> /stylesheets
>> /javascripts
>> base_template.html
>> some_other_template.html
>>
>>   /app1
>> model_name.py
>> etc
>>
>> Is this even close? I know the structure is up to me, but I'd like to
>> establish a good pattern for organization.
>>
>> Thanks for your advice!
>>
>> Brandonwww.btaylordesign.com
>> 
>
> This is fairly close to what I'd do, but with two important
> exceptions.
>
> One, *don't put your code in your website root*! It does not need to
> be read by your webserver, and shouldn't be accessible for external
> users - that's a big security risk (imagine someone browsing to your
> settings.py and reading your database password). Put it in your home
> directory, or a central code area, but not under your Apache root.
>   

or make sure you have a proper .htaccess in the directory. But I agree, 
out the root
is better

-- tony


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



[newbie]Apache Deployment Problem

2008-02-06 Thread Tony Winslow

Hi, all!
I installed mod_python and do the configurations as the tutorial on the 
official site. But mod_python still can not find the mysite.settings 
module. What might be the problem?

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



new to django

2008-02-06 Thread Beema shafreen
Hi everybody i am new to django,

I am trying to create my own project using django,

I have a got an error when in logged in with the password and user name

the error is
Request Method: GET  Request URL: http://192.168.5.26:8000/admin/  Exception
Type: ProgrammingError  Exception Value: (1146, "Table '
genemass.django_admin_log' doesn't exist")  Exception Location:
/var/lib/python-support/python2.4/MySQLdb/connections.py
in defaulterrorhandler, line 35
can some one suggest me what is the  error. how should i correct it


An  another  problem i am facing is using the forms  says for  example  in
the chapter  7 they have given  in forms  book/search.html  where should
this search .html be actually stored.


Regards

shafreen

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



Re: How to organize a django website

2008-02-06 Thread Brandon Taylor

Thanks for the advice Daniel. So something like this would be
better...

/my_shared_web_host_folder# not accessible
  /my_django_project # not accessible
/source
  settings.py, etc

/templates
  base_template.html, etc

/app1
/app2, etc

  /public_html - website(s) root # - accessible to internet
/images
/css
/javascripts, etc
/non-related html files, etc

Thanks again,
Brandon

On Feb 6, 7:31 am, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Feb 6, 1:17 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello everyone,
>
> > I'm just getting started, so please bear with me. How should I
> > organize my website? I haven't seen a definitive example of where to
> > put settings files, templates, applications, images, stylesheets, etc.
>
> > My best guess would be something like:
>
> > /website_root
> >   /source
> >     settings.py
> >     urls.py
> >     __init__.py
>
> >   /templates
> >     /images
> >     /stylesheets
> >     /javascripts
> >     base_template.html
> >     some_other_template.html
>
> >   /app1
> >     model_name.py
> >     etc
>
> > Is this even close? I know the structure is up to me, but I'd like to
> > establish a good pattern for organization.
>
> > Thanks for your advice!
>
> > Brandonwww.btaylordesign.com
>
> This is fairly close to what I'd do, but with two important
> exceptions.
>
> One, *don't put your code in your website root*! It does not need to
> be read by your webserver, and shouldn't be accessible for external
> users - that's a big security risk (imagine someone browsing to your
> settings.py and reading your database password). Put it in your home
> directory, or a central code area, but not under your Apache root.
>
> Secondly, don't put your images/JS/CSS in the same place as your
> templates. Templates, like code, don't need to be accessible to the
> webserver. Put them in the same place as the Python code - either a
> general templates/ directory based at the same root as your project
> source, or separate templates directories under each app. Some people
> prefer one, some the other - it's up to you.
>
> But images, JS and CSS *do* need to be accessible to whatever method
> you're using to serve them - don't forget, Django won't do that for
> you. So if you want to keep them with your code, you can symlink them
> to your Apache directory - but that will be easier if you put them in
> their own directory, called something like /site_media/.
>
> --
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django version for production?

2008-02-06 Thread Christian W. Koch

exactly, that's what i meant. i usually skip a staging server, for
cost reasons, and configure my dev box to run the same configuration
as my production server. either way, keneth and jarek are right. the
point is that trunk is as safe as you want it to be, or at least as
pain-free as you want.

On Feb 6, 3:46 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 06-Feb-08, at 2:08 PM, Jarek Zgoda wrote:
>
> >> you do have a development environment, right? ;)
>
> > I remember one issue just after autoescaping went into trunk, that was
> > visible only on sites runnung on FastCGI, so development server/env
> > sometimes clearly is not enough to catch everything.
>
> even if you do development using the development server, you should  
> have a staging server replicating your production environment - or  
> else do your development on a machine that replicates the production  
> environment.
>
> Further the staging server should be tested with data taken from the  
> production environment and not from test data.
>
> This is what is known as a development environment.
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
> Foss Conference for the common man:http://registration.fossconf.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new to django

2008-02-06 Thread Brandon Taylor

Hello Beema,

Do you have the Python MySQL adapter installed? If not you, can find
the downloads at http://sourceforge.net/projects/mysql-python.

I'm not sure regarding the location of your template HTML file, I've
asked the group for an example of how to organize a Django project in
this post: 
http://groups.google.com/group/django-users/browse_thread/thread/4405a8c8c2319bd4

Cheers,
Brandon

Beema shafreen wrote:
> Hi everybody i am new to django,
>
> I am trying to create my own project using django,
>
> I have a got an error when in logged in with the password and user name
>
> the error is
> Request Method: GET  Request URL: http://192.168.5.26:8000/admin/  Exception
> Type: ProgrammingError  Exception Value: (1146, "Table '
> genemass.django_admin_log' doesn't exist")  Exception Location:
> /var/lib/python-support/python2.4/MySQLdb/connections.py
> in defaulterrorhandler, line 35
> can some one suggest me what is the  error. how should i correct it
>
>
> An  another  problem i am facing is using the forms  says for  example  in
> the chapter  7 they have given  in forms  book/search.html  where should
> this search .html be actually stored.
>
>
> Regards
>
> shafreen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to organize a django website

2008-02-06 Thread Daniel Roseman



On Feb 6, 1:17 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm just getting started, so please bear with me. How should I
> organize my website? I haven't seen a definitive example of where to
> put settings files, templates, applications, images, stylesheets, etc.
>
> My best guess would be something like:
>
> /website_root
>   /source
> settings.py
> urls.py
> __init__.py
>
>   /templates
> /images
> /stylesheets
> /javascripts
> base_template.html
> some_other_template.html
>
>   /app1
> model_name.py
> etc
>
> Is this even close? I know the structure is up to me, but I'd like to
> establish a good pattern for organization.
>
> Thanks for your advice!
>
> Brandonwww.btaylordesign.com

This is fairly close to what I'd do, but with two important
exceptions.

One, *don't put your code in your website root*! It does not need to
be read by your webserver, and shouldn't be accessible for external
users - that's a big security risk (imagine someone browsing to your
settings.py and reading your database password). Put it in your home
directory, or a central code area, but not under your Apache root.

Secondly, don't put your images/JS/CSS in the same place as your
templates. Templates, like code, don't need to be accessible to the
webserver. Put them in the same place as the Python code - either a
general templates/ directory based at the same root as your project
source, or separate templates directories under each app. Some people
prefer one, some the other - it's up to you.

But images, JS and CSS *do* need to be accessible to whatever method
you're using to serve them - don't forget, Django won't do that for
you. So if you want to keep them with your code, you can symlink them
to your Apache directory - but that will be easier if you put them in
their own directory, called something like /site_media/.

--
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: new to django

2008-02-06 Thread Ronaldo Z. Afonso

Hi,

I'm new to djando too, but try issue this command in your project
direcotry: python manage.py syncdb. Don't forget to check your database
configuration.
Good luck.

Ronaldo

On Wed, 2008-02-06 at 18:38 +0530, Beema shafreen wrote:
> Hi everybody i am new to django,
> 
> I am trying to create my own project using django,
> 
> I have a got an error when in logged in with the password and user
> name
> 
> the error is  
>   Request Method:
> GET
>Request URL:
> http://192.168.5.26:8000/admin/
>   Exception Type:
> ProgrammingError
>  Exception Value:
> (1146, "Table
> 'genemass.django_admin_log' doesn't
> exist")
> Exception Location:
> /var/lib/python-support/python2.4/MySQLdb/connections.py in 
> defaulterrorhandler, line 35
> 
> can some one suggest me what is the  error. how should i correct it
> 
> 
> An  another  problem i am facing is using the forms  says for  example
> in the chapter  7 they have given  in forms  book/search.html  where
> should this search .html be actually stored. 
> 
> 
> Regards
> 
> shafreen
> > 


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



Re: AssertionError on a model

2008-02-06 Thread Nader

Thank you for this conceptual remark.
Could the "ForeignKey" filed be a "primary_key at the same time?

datasetID = models.ForeignKey(Dataset, db_column="datasetID",
primary_key=True)

 I suppose I can define a group of fields as "primary_key" by using of
the next statement :

 Class Model(..)

datasetID
 class Meta:
  .
  unique_together = (("datasetID", "filename", "fileVersion"),)

Cheers,
Nader

On Feb 6, 2:21 pm, Pete Crosier <[EMAIL PROTECTED]> wrote:
> A model can only use one field as its primary key and
> Distributequeue.objects.get() should only return one object.
>
> http://www.djangoproject.com/documentation/model-api/#primary-keyhttp://www.djangoproject.com/documentation/db-api/#get-kwargs
>
> Cheers, Pete.
>
> On Feb 6, 12:11 pm, Nader <[EMAIL PROTECTED]> wrote:
>
> > Hallo,
>
> > I have a model as following:
>
> > class Distributequeue(models.Model):
> > datasetID = models.ForeignKey(Dataset, db_column="datasetID",
> > primary_key=True)
> > filename = models.CharField(primary_key=True, maxlength=240)
> > fileVersion = models.CharField(primary_key=True, maxlength=48)
> > distributeModuleID = models.ForeignKey(Distributemodule,
> > db_column="distributeModuleID")
> > timeOfEntry = models.DateTimeField()
> > status = models.CharField(blank=True, maxlength=240)
> > timeOfLastStatusUpdate = models.DateTimeField()
> > PID = models.IntegerField()
>
> > def __str__(self):
> > return self.filename
>
> > class Admin:
> > list_display = ('fileVersion', 'timeOfEntry', 'status')
> > list_per_page = 20
> > search_fields = ('filename', 'status')
>
> > class Meta:
> > db_table = 'distributeQueue'
> > unique_together = (("datasetID", "filename", "fileVersion"),)
>
> > Unfortunately I can't understand the next message which I get from
> > "Admin Intreface" for an application.
>
> > AssertionError at /admin/distributequeues/distributequeue/SCIA_2F6.03/
> > get() returned more than one Distributequeue -- it returned 763!
> > Lookup parameters were {'pk': 'SCIA/6.03'}
>
> > What does it mean?
>
> > would somebody tell me how I can solve this problem?
>
> > Regards,
> > Nader
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to organize a django website

2008-02-06 Thread Brandon Taylor

Hello everyone,

I'm just getting started, so please bear with me. How should I
organize my website? I haven't seen a definitive example of where to
put settings files, templates, applications, images, stylesheets, etc.

My best guess would be something like:

/website_root
  /source
settings.py
urls.py
__init__.py

  /templates
/images
/stylesheets
/javascripts
base_template.html
some_other_template.html

  /app1
model_name.py
etc

Is this even close? I know the structure is up to me, but I'd like to
establish a good pattern for organization.

Thanks for your advice!

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



need some help

2008-02-06 Thread bunicutadincarrefour

i am participating to a little contest and i need some votes...if you
woud like to help me, you could just click the following link...you'll
just vote for a picture with me and my girlfriend.
Thanks a lot! this is the link :
http://www.jurnale.ro/concurs/index.php?pag=61_id=1973=vote
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AssertionError on a model

2008-02-06 Thread Pete Crosier

A model can only use one field as its primary key and
Distributequeue.objects.get() should only return one object.

http://www.djangoproject.com/documentation/model-api/#primary-key
http://www.djangoproject.com/documentation/db-api/#get-kwargs

Cheers, Pete.

On Feb 6, 12:11 pm, Nader <[EMAIL PROTECTED]> wrote:
> Hallo,
>
> I have a model as following:
>
> class Distributequeue(models.Model):
>     datasetID = models.ForeignKey(Dataset, db_column="datasetID",
> primary_key=True)
>     filename = models.CharField(primary_key=True, maxlength=240)
>     fileVersion = models.CharField(primary_key=True, maxlength=48)
>     distributeModuleID = models.ForeignKey(Distributemodule,
> db_column="distributeModuleID")
>     timeOfEntry = models.DateTimeField()
>     status = models.CharField(blank=True, maxlength=240)
>     timeOfLastStatusUpdate = models.DateTimeField()
>     PID = models.IntegerField()
>
>     def __str__(self):
>         return self.filename
>
>     class Admin:
>         list_display = ('fileVersion', 'timeOfEntry', 'status')
>         list_per_page = 20
>         search_fields = ('filename', 'status')
>
>     class Meta:
>         db_table = 'distributeQueue'
>         unique_together = (("datasetID", "filename", "fileVersion"),)
>
> Unfortunately I can't understand the next message which I get from
> "Admin Intreface" for an application.
>
> AssertionError at /admin/distributequeues/distributequeue/SCIA_2F6.03/
> get() returned more than one Distributequeue -- it returned 763!
> Lookup parameters were {'pk': 'SCIA/6.03'}
>
> What does it mean?
>
> would somebody tell me how I can solve this problem?
>
> Regards,
> Nader
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



AssertionError on a model

2008-02-06 Thread Nader

Hallo,

I have a model as following:

class Distributequeue(models.Model):
datasetID = models.ForeignKey(Dataset, db_column="datasetID",
primary_key=True)
filename = models.CharField(primary_key=True, maxlength=240)
fileVersion = models.CharField(primary_key=True, maxlength=48)
distributeModuleID = models.ForeignKey(Distributemodule,
db_column="distributeModuleID")
timeOfEntry = models.DateTimeField()
status = models.CharField(blank=True, maxlength=240)
timeOfLastStatusUpdate = models.DateTimeField()
PID = models.IntegerField()

def __str__(self):
return self.filename

class Admin:
list_display = ('fileVersion', 'timeOfEntry', 'status')
list_per_page = 20
search_fields = ('filename', 'status')

class Meta:
db_table = 'distributeQueue'
unique_together = (("datasetID", "filename", "fileVersion"),)


Unfortunately I can't understand the next message which I get from
"Admin Intreface" for an application.

AssertionError at /admin/distributequeues/distributequeue/SCIA_2F6.03/
get() returned more than one Distributequeue -- it returned 763!
Lookup parameters were {'pk': 'SCIA/6.03'}

What does it mean?

would somebody tell me how I can solve this problem?

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



Re: Opinion requested on issue related to model inheritance and exceptions

2008-02-06 Thread Kenneth Gonsalves


On 06-Feb-08, at 3:07 PM, Safariman wrote:

> I'd like some opinions about something. I'd like to know if this is
> correct behavior or if it could be considered a bug in django.
>
> This issue is related to 2 models where one model is the superclass of
> the other. Let me illustrate with an small abstract example.

model inheritance last worked in 0.91 - and that too not well. It is  
not supported

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



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



Re: Opinion requested on issue related to model inheritance and exceptions

2008-02-06 Thread Safariman

After asking around in #django it dawned to me that model inheritance
is something which isn't really supported in Django, so I'll just have
to think of a different solution.

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



Re: how to get raw_id_admin value from foreign key field?

2008-02-06 Thread sector119

def my_callback(field, **kwargs):
  if field.rel.raw_id_admin:
return TextField()
  else:
return field.formfield(**kwargs)

On 6 Лют, 11:36, sector119 <[EMAIL PROTECTED]> wrote:
> Oh, sorry! I mean foreign key, not primary key :(
>
> On 6 Лют, 11:32, sector119 <[EMAIL PROTECTED]> wrote:
>
> > Hi ALL!
>
> > How can I check that model M has some primary key field with
> > raw_id_admin value set to True? How can I access this option? I'm
> > tired of looking for this option using dir() :)
>
> > P.S. I do not know name of the PK field. I try to substitute
> > ChoiceField with TextField usinc formfield_callback in my form that
> > was generated dynamicly with ModelForm!
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Opinion requested on issue related to model inheritance and exceptions

2008-02-06 Thread Safariman

Hello all,

I'd like some opinions about something. I'd like to know if this is
correct behavior or if it could be considered a bug in django.

This issue is related to 2 models where one model is the superclass of
the other. Let me illustrate with an small abstract example.

class Parent(models.Model):
... (some fields) ...

class Child(Parent):
... (some more fields) ...

In practice I won't do a lot with the Parent model, but since I'm
planning to make a few variations of the Child model, which need a lot
of the same fields and functions, I'd like to define them in the
Parent model and use them in the Child models to avoid the need for
reduntant code. So far so good.

Now I noticed in a view some behavior that I considered a bit
puzzling. The view starts basically like this:

def view(request, some_identifier):
try:
instance = Child.objects.get(some_field=some_identifier)
except Child.DoesNotExist:
... (do something) ...

I noticed that if there wasn't an instance which met the requirements
the DoesNotExist exception didn't get caught by the try: except ...
section. However, if I tried to 'except Parent.DoesNotExist' the
exception was caught.

I feel that the wrong type of exception is being raised, but would
like other people input before deciding to make a ticket.

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



Re: how to get raw_id_admin value from foreign key field?

2008-02-06 Thread sector119

Oh, sorry! I mean foreign key, not primary key :(

On 6 Лют, 11:32, sector119 <[EMAIL PROTECTED]> wrote:
> Hi ALL!
>
> How can I check that model M has some primary key field with
> raw_id_admin value set to True? How can I access this option? I'm
> tired of looking for this option using dir() :)
>
> P.S. I do not know name of the PK field. I try to substitute
> ChoiceField with TextField usinc formfield_callback in my form that
> was generated dynamicly with ModelForm!
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to get raw_id_admin value from foreign key field?

2008-02-06 Thread sector119

Hi ALL!

How can I check that model M has some primary key field with
raw_id_admin value set to True? How can I access this option? I'm
tired of looking for this option using dir() :)

P.S. I do not know name of the PK field. I try to substitute
ChoiceField with TextField usinc formfield_callback in my form that
was generated dynamicly with ModelForm!

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending Django's admin application

2008-02-06 Thread David Reynolds


On 6 Feb 2008, at 2:09 am, Brandon Taylor wrote:

>
> Excellent, I already have that library installed from working through
> the book samples.
>
> Rails has several plugin websites, like www.agilewebdevelopment.com.
> Is there something similar for Django? My Google searches haven't come
> up with a lot in that regard.


You might find djangosnippets.org useful although I wouldn't call the  
snippets on there plugins, but you can usually find a bit of code  
doing something similar to what you want.

In terms of thumbnailing, there are a couple of apps around that will  
do it, most notable are listed here:

http://code.djangoproject.com/wiki/ThumbNails




-- 
David Reynolds
[EMAIL PROTECTED]



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



Re: Model Blues - A Newbie's question

2008-02-06 Thread nikosk

Awesome. Thanks ...

On Feb 5, 1:00 am, r_f_d <[EMAIL PROTECTED]> wrote:
> Sure, you can do it, with two (at least) ways, one is to put this into
> your model so it automatically happens, search the documentation or
> users group for threadlocals middleware.  The other way is to simply
> put it into your view as all views get the request, request.user will
> provide you with what you need.
>
> On Feb 4, 2:48 pm, nikosk <[EMAIL PROTECTED]> wrote:
>
> > I need the default value of a field in a model to be the id of the
> > user creating the new instance of the object the model is modeling
> > ( am I making sense at all?)
>
> > i.e. :
> > class Article(models.Model):
> > category = models.ForeignKey(Category)
> > title = models.CharField(max_length=200)
> > sub_title = models.CharField(max_length=200)
> > intro_text = models.TextField(blank=True)
> > main_text = models.TextField()
> > pub_date = models.DateTimeField(default=datetime.now)
> > author = models.ForeignKey(User)
>
> > When someone is creating a new Article in the admin app I want the new
> > Article's author field to be the user's id.
>
> > Is that possible ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django version for production?

2008-02-06 Thread Kenneth Gonsalves


On 06-Feb-08, at 2:08 PM, Jarek Zgoda wrote:

>> you do have a development environment, right? ;)
>
> I remember one issue just after autoescaping went into trunk, that was
> visible only on sites runnung on FastCGI, so development server/env
> sometimes clearly is not enough to catch everything.

even if you do development using the development server, you should  
have a staging server replicating your production environment - or  
else do your development on a machine that replicates the production  
environment.

Further the staging server should be tested with data taken from the  
production environment and not from test data.

This is what is known as a development environment.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



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



Re: django version for production?

2008-02-06 Thread Jarek Zgoda

Christian W. Koch napisał(a):

> i'm no django expert, yet, but i use trunk. now, for production
> purposes i still use trunk because before i "svn up" on production i
> make sure that the site runs on my development box on the latest
> trunk.
> 
> you do have a development environment, right? ;)

I remember one issue just after autoescaping went into trunk, that was
visible only on sites runnung on FastCGI, so development server/env
sometimes clearly is not enough to catch everything.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

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



Re: Read-only connection to database. How to?

2008-02-06 Thread James Bennett

On Feb 6, 2008 1:43 AM, koenb <[EMAIL PROTECTED]> wrote:
> You could take a look at the multidb branch (specifically check out
> ticket #4747). It is a bit behind on trunk, but the basics should
> work. It allows you to define multiple connections, so you should be
> able to connect to the same db using different users.

If all he wants is a single method doing raw queries on a different
connection, that's easy enough to do without needing a massive rewrite
of Django -- he can just import the correct DB adapter module, set up
a connection and go.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: User login form

2008-02-06 Thread eraoul

P.S. A current bug I have in my login system is maddening: if I try to
login (using the real basic username/password form I copied out of the
django book, and using the built-in django.auth.views.login function),
my login will work great the first time. I have a redirect to a
"start" page using the "next" hidden field, and that works fine.

However, if I do a logout, and then try to log back in, I get
redirected to the /accounts/login page instead of the place specified
in "next". I can navigate to a user-only page manually and confirm
that I was logged back in successfully, but that redirect seems to be
broken.

When I login, it seems that every-other login request will go to the
correct redirect, and the alternate ones will go to the /accounts/
login/ page where the login form is displayed; this is also where I
redirect to if the login is unsuccessful.   Any ideas what might be
going wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---