Re: I would like to report a bug but I can't log in

2009-01-03 Thread Malcolm Tredinnick

On Sat, 2009-01-03 at 22:03 -0800, Friendless wrote:
> On Jan 4, 2:42 pm, "Karen Tracey"  wrote:
> > I'll admit your tone here is starting to make me lose interest in your
> > problem report.
> 
> Admit it, you weren't very interested in the first place. You've given
> me all sorts of reasons as to why the bug shouldn't be fixed, despite

Wow. That's just unbelievably rude. If somebody isn't interested in
helping you, they won't reply to the original mail, not spend a few
thousand words and four responses trying to help work out what is going
on and untold hours trying to repeat the problem.

If you don't like using Django, that's fine, but having followed this
thread, I can say that you are leaping to some fairly large and
unjustified conclusions and being very unfair to Karen and Ramiros'
efforts. Please grow some manners.

Malcolm



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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Karen Tracey
On Sun, Jan 4, 2009 at 1:03 AM, Friendless wrote:

>
> On Jan 4, 2:42 pm, "Karen Tracey"  wrote:
> > I'll admit your tone here is starting to make me lose interest in your
> > problem report.
>
> Admit it, you weren't very interested in the first place. You've given
> me all sorts of reasons as to why the bug shouldn't be fixed, despite
> (a) evidence that it is a bug, and (b) at least a clue as to how to
> fix it. The simple fact of the matter is that Django failed on the
> very first thing I did with it, your website doesn't work (yes, I did
> try logging in using the link as Ramiro suggested), and my first
> encounter with the community has been hostile. Django's doing nothing
> for me, and I refuse to get involved with a community that won't even
> believe me, let alone help. I've given you a good bug report, but now
> I'm out of here. Do whatever you like.
>

If I had no interest in fixing the bug I would not have responded nor tried
to recreate it on two different machines (installing a new version of MySQL
on one of them to do so).  I simply stated that it isn't high enough
priority for me to pursue any further at this point given my knowledge of
the code, what I feel are the numbers of people that might hit this problem,
and and the fact that I cannot recreate it.  I am sorry if you feel that was
hostile.  I'm sorry Django doesn't fit your needs and good luck with
whatever software you choose to use instead.

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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Friendless

On Jan 4, 2:42 pm, "Karen Tracey"  wrote:
> I'll admit your tone here is starting to make me lose interest in your
> problem report.

Admit it, you weren't very interested in the first place. You've given
me all sorts of reasons as to why the bug shouldn't be fixed, despite
(a) evidence that it is a bug, and (b) at least a clue as to how to
fix it. The simple fact of the matter is that Django failed on the
very first thing I did with it, your website doesn't work (yes, I did
try logging in using the link as Ramiro suggested), and my first
encounter with the community has been hostile. Django's doing nothing
for me, and I refuse to get involved with a community that won't even
believe me, let alone help. I've given you a good bug report, but now
I'm out of here. Do whatever you like.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread Graham Dumpleton



On Jan 4, 3:11 pm, garagefan  wrote:
> this is rather aggravating as i'm unsure what exactly I need to give
> you to help me :/ this isn't your fault at all, as i'm an
> unexperienced with working with servers, mod_python, python and
> django.
>
> i am learning all this as I go along.
>
> i've got two websites on my server, both with different IP addresses
> (obviously)
>
> they reside in
>
> /home/kdwadmin
> and
> /home/kdwadmin2
>
> the first directory above has another folder in it w/ my django files.
> full directory is /home/kdwadmin/mysite
>
> nevermind that my django files are placed in an inappropriate spot,
>
> i will be taking care of that shortly, /home/django/kdwadmin will
> contain the apps for the first site while there will be no directory
> for the second site at this time.
>
> my 's were set up as per the djangoprojects.com tutorial
>
> the first directory, that includes the django apps, is for website
> kennethdavid.net, the second for carclubhub.com.
>
> so what i need to do is set up a virtual host for both sites, one that
> will point kennethdavid.net/* to the django app and another that will
> say carclubhub.com/* SetHandler None
>
> there is only one port under "Listen" in the apache config file.
> Should i create an ip specific listen for each website? and have :80
> for one and :81 for the other and would that allow me to create two
> VirtualHosts? one for each port?

Sorry if I have come across as a bit short with you. Feeling a bit
under pressure at the moment with a report I have to do for work. I'll
try and explain things in a bit better detail for you. Hopefully it
will help with understanding Django documentation, which in my opinion
is not too clear in some areas in relation to mod_python setup. :-)

The whole point of virtual hosts as supported by the 'Host' header in
HTTP/1.1 requests, is that it is possible to support multiple named
hosts on a single IP address/port. Thus it is sufficient to have a
single Listen directive for just port 80. As you already had, you do
also need to define the NameVirtualHost directive appropriately to
enable virtual host resolution on that port. The wildcard, ie., '*'
means that this virtual host resolution will occur no matter what IP
address was used. So the directives:

  Listen 80
  NameVirtualHost *:80

would be fine.

The next thing is to define a VirtualHost container for each virtual
host.

Since as explained above, the whole point of virtual hosts is support
more than one site on an IP at same port, you didn't actually need a
separate IP for each site. The only time you might really need
multiple IPs on same box for web hosting is if you wanted to use the
box to host a different site, but have it be hosted using a different
web server instance. For example, people often use nginx or lighttpd
to host static media files. If not on a different box and want
everything to appear at port 80, you need multiple IPs. Each web
server would then only listen on IP address for that server. That is
rather than '80', would listen on 'A.B.C.D:80'.

Anyway, ignoring multiple IPs and assuming only one, the VirtualHost
containers would then be:

  
  ServerName kennethdavid.net
  DocumentRoot /home/kdwadmin

  ...
  

  
  ServerName carclubhub.com
  DocumentRoot /home/kdwadmin2

  ...
  

That sets up the virtual hosts, but not Django itself.

For Django, since you want to mount Django at root of the virtual
host, ignoring issues of where Django code is located for now,
configuration would be:

  
  ServerName kennethdavid.net
  DocumentRoot /home/kdwadmin

  
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/kwadmin', '/home/kwadmin/mysite] +
sys.path"



SetHandler None



SetHandler None


  

Note that no 'django.root' option is required for Django 1.0 if
mounted at '/'. That option is not relevant to older versions of
Django.

Note that both parent of Django directory and the Django directory are
listed to reduce chances of problems if you didn't list 'mysite' in
module references in urls.py or elsewhere.

The above assumes that the static file directories are under
DocumentRoot, thus:

  /home/kwadmin/styles
  /home/kwadmin/images

These should be physical copies of the directory/files and not a
symlink if Apache not configured for allowing following of symlinks
under directory associated with DocumentRoot.

The other site would be similar:

  
  ServerName carclubhub.com
  DocumentRoot /home/kdwadmin2

  
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/kwadmin2', '/home/kwadmin2/mysite] +
sys.path"



SetHandler None



SetHandler None


  

Only other thing to add is that because Apache r

Re: Tutorial Problem

2009-01-03 Thread Justin Myers

It failed after it imported your settings file the first time, so I
don't think the problem's there; it also got the folder name right, so
it looks like it's just failing to recognize it as a Python package.
Any chance you got rid of __init__.py (empty file in the mysite
folder) by mistake?

On Jan 2, 8:01 am, rvwilliams  wrote:
> Hi
>
> I'm just getting started on django and I'm using a Windows Vista
> version.  Yesterday I completed about half of the tutorial without too
> much difficulty.  Now I'm trying to carry on from where I stopped.
> The first thing I need to do is to restart the test server, so I go
> into the 'mysite' folder and type "python manage.py runserver".  This
> fails with this traceback
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
>     execute_manager(settings)
>   File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 338, in execute_manager
>     setup_environ(settings_mod)
>   File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 316, in setup_environ
>     project_module = __import__(project_name, {}, {}, [''])
> ImportError: No module named mysite
>
> I haven't changed anything from yesterday and I just can't work out
> why the server can't start again.  In fact if I try anything with
> manage.py, I get the same traceback.
>
> Can someone help me get back on track?
>
> Thanks.
>
> Richard Williams.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Please help me anyone

2009-01-03 Thread priyankeshu

ok... i am good at html and CSS and i have done little bit of old
school C programming and databases i have never got a chance to work
on real world programming projects

i am looking for an online guru (to teach me python/django) i want to
learn how to build websites in python. You can guide me by doin things
remotely on my pc

i don't want to use php for some reason

send me a message or add me at priyankeshu.parihar at gmail.com on
google talk...


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



File Download

2009-01-03 Thread Sparky

Hello. This is probably a silly question but I have files being stored
onto a server and strangely getting them there was very easy but how
can I get them back down?

Thank you for your patience in advance,
Sam

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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Karen Tracey
On Sat, Jan 3, 2009 at 4:43 PM, Friendless wrote:

> I'm using MySQL 5.0.51a on Ubuntu Hardy Heron.
>

Hmm, that looks later than what I tested on (5.0.45).  I'm not wanting to
mess with the install I have on Ubuntu, so I installed the latest 5.0.67
community version on a test machine (which happens to be a Windows box) and
I still can't recreate what you see:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE `games` (
->  `bggid` int(10) unsigned NOT NULL,
->  `name` varchar(256) NOT NULL default '',
[snipped all the others]
->  PRIMARY KEY  (`bggid`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.32 sec)

mysql> CREATE TABLE `expansions` (
->  `basegame` int(10) unsigned NOT NULL,
->  `expansion` int(10) unsigned NOT NULL,
->  KEY `expansions_basegame` (`basegame`),
->  KEY `expansions_expansion` (`expansion`),
->  CONSTRAINT `expansions_basegame` FOREIGN KEY (`basegame`) REFERENCES
-> `games` (`BGGID`),
->  CONSTRAINT `expansions_expansion` FOREIGN KEY (`expansion`)
-> REFERENCES `games` (`BGGID`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.27 sec)

mysql> select column_name, referenced_table_name,
-> referenced_column_name from information_schema.key_column_usage where
-> table_name = 'expansions' and table_schema = DATABASE() and
-> referenced_table_name is not null and referenced_column_name is not
-> null;
+-+---++
| column_name | referenced_table_name | referenced_column_name |
+-+---++
| basegame| games | bggid  |
| expansion   | games | bggid  |
+-+---++
2 rows in set (10.40 sec)


> As you say, this is a somewhat obscure bug. I guess the question is,
> do you want your product to work or not? You've acknowledged it's a
> valid problem.


I'll admit your tone here is starting to make me lose interest in your
problem report.  But, perhaps I am misinterpreting your tone, and I do in
fact like to help fix Django bugs, which this seems to be, so I'll just
say:  Django is not "my product".  None of the $0.00 you paid for Django
found its way into my pocket.  I'm a contributor, one among many.  That
doesn't make Django "mine".  Nor does one bug remove Django from the class
of software that "works".  There would be precious little software you could
call "working" if that was the case.



> I tried to use Django 0.92 when it was the latest
> version and inspectdb fell over. I can't remember whether it was the
> same problem. Anyway, at the time I just lost interest and ignored
> Django for a year. So I'd gone to the trouble of installing the
> product, I'd bought and read the book, and when I went to use it it
> fell over on the very first thing I tried to do. That's a pretty good
> way to stop users from getting very far with your product. But hey,
> you develop your product how you like.
>

You seem to be missing the fact that Django is nobody's product but rather
an open source project.  Community members contribute according to their own
interests, abilities, and availability. You've apparently hit a bug, due it
seems to your database having characteristics not considered by whoever
wrote inspectdb.  That's unfortunate.  You've reported it -- thanks for
that.  Please realize, though, that in an all-volunteer community getting an
obscure bug that you happen to care about fixed may require more from you
than simply reporting the problem, posting a fix that happened to work for
your specific case, and threatening that failure to fix the bug will  scare
away untold numbers of new users.



>
> Yes, my fix was fragile. I didn't have the inclination to spend a lot
> of time fixing a product which until then had done nothing for me. I
> presume there are people who know a whole lot more about the code than
> I do who can maybe even log into the website.
>

Sorry, but I don't happen to be someone who knows any more about that code
than you do, and I cannot recreate the problem.  So developing a more robust
fix is not going to be high on my priority list.  Since you can recreate it,
it might be good for Django and helpful to the next person who happens to
start out with a similarly configured DB if you chose to make the effort to
develop and post a more robust fix, but that's entirely up to you.

On the login, Ramiro has responded with something he encountered on a new
login that may help you get past what you are seeing.  There is also the
settings page option:

http://code.djangoproject.com/settings

that I mentioned a couple of times with no feedback from you as to whether

Re: Tutorial Problem

2009-01-03 Thread waltbrad



On Jan 2, 9:01 am, rvwilliams  wrote:
> Hi
>
> I'm just getting started on django and I'm using a Windows Vista
> version.  Yesterday I completed about half of the tutorial without too
> much difficulty.  Now I'm trying to carry on from where I stopped.
> The first thing I need to do is to restart the test server, so I go
> into the 'mysite' folder and type "python manage.py runserver".  This
> fails with this traceback
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
>     execute_manager(settings)
>   File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 338, in execute_manager
>     setup_environ(settings_mod)
>   File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 316, in setup_environ
>     project_module = __import__(project_name, {}, {}, [''])
> ImportError: No module named mysite
>
> I haven't changed anything from yesterday and I just can't work out
> why the server can't start again.  In fact if I try anything with
> manage.py, I get the same traceback.
>
> Can someone help me get back on track?

I'm fairly new myself rv, so I doubt I can help you much.  But, if I
were in your shoes right now, I'd delete the folder you created and
start the tutorial over.  It couldn't hurt you too much to review what
you've done and it shouldn't take too long to do it a second time
anyway.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread garagefan

this is rather aggravating as i'm unsure what exactly I need to give
you to help me :/ this isn't your fault at all, as i'm an
unexperienced with working with servers, mod_python, python and
django.

i am learning all this as I go along.

i've got two websites on my server, both with different IP addresses
(obviously)

they reside in

/home/kdwadmin
and
/home/kdwadmin2

the first directory above has another folder in it w/ my django files.
full directory is /home/kdwadmin/mysite

nevermind that my django files are placed in an inappropriate spot,

i will be taking care of that shortly, /home/django/kdwadmin will
contain the apps for the first site while there will be no directory
for the second site at this time.

my 's were set up as per the djangoprojects.com tutorial

the first directory, that includes the django apps, is for website
kennethdavid.net, the second for carclubhub.com.

so what i need to do is set up a virtual host for both sites, one that
will point kennethdavid.net/* to the django app and another that will
say carclubhub.com/* SetHandler None

there is only one port under "Listen" in the apache config file.
Should i create an ip specific listen for each website? and have :80
for one and :81 for the other and would that allow me to create two
VirtualHosts? one for each port?

On Jan 3, 10:21 pm, Graham Dumpleton 
wrote:
> On Jan 4, 1:39 pm, garagefan  wrote:
>
> > there is currently only one virtual host set up, for the site i'm
> > working on. I do not need anything to happen with the other url.
>
> But why are you mentioning 'site2' in one of the other posts and
> seeing for it what you only expect for 'site1'.
>
> > i simply need a virtual host forwww.website.netthatsits at /home/
> > site1/ on my server that has a django directory at /home/site1/mysite
> > to work.
>
> Your initial configuration mentions /home/html in PythonPath. It is
> very frustrating when people do not post exactly the Apache
> configuration they are using and then try and describe in generic
> terms using fake names and paths. It is okay if it is all consistent,
> but your descriptions keep changing.
>
> > the django files themselves at  /mysite work just fine,
>
> Can you clarify when you are talking about a URL or a directory. If a
> directory, specify full path.
>
> That you are mentioning '/mysite' here again is confusing because it
> suggests a URL for a Django instance mounted at sub url of site, yet
> you already seemed to have said you want to mount it at root of host,
> ie., '/'.
>
> > and
> > were working before i attempted to set up the virtual host. and
> >www.website.netwas working just fine as well with the way the
> > 's are currently set up, before the virtual host stuff was
> > added.
>
> > i figure i'm missing something before the first  that is
> > causing the issue of the directory for the django apps not to be read.
> > I do not want to set them up in the public_html directory as that is
> > the main site directory, which if per chance i need to give someone
> > access to that... i don't want them in the django directories at all.
>
> It is unclear here whether you are talking about static files, eg.
> images and stylesheets, or Django code. You should never stick Django
> directory containing code inside of a Apache DocumentRoot directory
> for a host. Your better choices are to copy the static file
> directories into DocumentRoot or use a symlink to link them in from a
> different location. Depending on Apache configuration you may need to
> set FollowSymLinks option. Alternatively, use an Alias directive in
> Apache to effectively mount them at required URL from some other
> directory location. Either way, mod_python is a PITA in that you need
> to have SetHandler None for the URL (Location) context where they are
> when whole Django site is mounted at a parent URL to the static files.
>
> > the server itself is a virtual server from godaddy running red hat 7
> > w/ apache and mod_python.
>
> > I was looking at a few pages and they mention DocumentRoot... should
> > this be to /home/site1 or to the project files?
>
> As I said above, you should never put Django code in DocumentRoot
> because a mistake in Apache configuration can expose your source code
> to download.
>
> > how does PythonInterpreter need to be applied?
>
> It doesn't if you are only hosting one Django site inside of a
> VirtualHost.
>
> Now, did you get rid of PythonOption to django.root which I said is
> not needed if mounting Django at root of site. Be aware though that
> that is an option only relevant to Django 1.0. Are you actually using
> Django 1.0? If you are using older version of Django, then you aren't
> reading the correct version of the documentation.
>
> Problem now is that still not even clear what you actual problem is
> any more. How about being very clear and give URLs for each request
> you are making and state whether it works. Ie., does '/' work, does '/
> images/...someimage.jpg' work, does some sub U

Re: Writing your first Django app

2009-01-03 Thread johan
Yes I been following your advise and done some basic Python learning. I
should obviously been doing this before starting with the tutorial but I
still think it should be a good idea to add the finessed code in the end of
each tutorial.

Anyway thanks Karen for taking time to help me out.

2009/1/3 Karen Tracey 

> On Fri, Jan 2, 2009 at 11:25 AM, johan  wrote:
>
>> OK it is finally working after a lot of strange errors! 3 hours spent on
>> this crap! Can you really trust the built in server that it always update
>> your code?
>>
>
> No, not if you introduce syntax errors into your code.  If it tries to
> reload and encounters errors, that may result in future reloads not
> happening as they would normally.  It is easy enough to ensure the server is
> reloaded, though, just force it by stopping and restarting the server
> yourself.  It's not that big a deal.
>
>
>>
>> Also It should be so much easier to follow this tutorial if all the code
>> from each tutorial was posted at the end of the tutorial. It is possible
>> somehow to pass that message to someone in charge for the tutorials?  For me
>> this thing with Indentation Errors is totally new.
>>
>> Thanks Karen for your help.
>>
>
> You seem to be struggling with some basic Python learning (indentation
> counts, e.g.).   I do not know that the tutorial would be doing you any
> favors by making it easier for you to sidestep learning such things.  If you
> are going to be programming in Python, you will need to master proper
> indentation, placement of methods within classes, etc.  The Django tutorial
> isn't meant to be a Python tutorial; if you are having trouble with basic
> Python stuff you may want to take a step back and first do some general
> Python learning.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



setting cookies following comment post

2009-01-03 Thread Eric Abrahamsen

Hi there,

I'm adding a "remember me" checkbox to comment forms, so that regular  
commenters can avoid having to enter their personal information, if  
they want. I was originally thinking of making this a function  
attached to the comment_was_posted signal, but it will have to be  
implemented using cookies, which need to be set on the outgoing  
response, which isn't available in signal handlers...

I'm wondering if anyone else has made a functionality like this using  
the comment contrib app, and how they went about doing it. There  
doesn't seem to be any point in the process where I could get hold of  
the response.

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



Re: Tutorial Problem

2009-01-03 Thread johan
Hopefully some more experienced will be able to help you out. You have not
updated the database or changed any permissions after it worked last time?
2009/1/4 rvwilliams 

>
> Absolutely certain!
>
>
> >
>

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



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread Graham Dumpleton



On Jan 4, 1:39 pm, garagefan  wrote:
> there is currently only one virtual host set up, for the site i'm
> working on. I do not need anything to happen with the other url.

But why are you mentioning 'site2' in one of the other posts and
seeing for it what you only expect for 'site1'.

> i simply need a virtual host for www.website.netthat sits at /home/
> site1/ on my server that has a django directory at /home/site1/mysite
> to work.

Your initial configuration mentions /home/html in PythonPath. It is
very frustrating when people do not post exactly the Apache
configuration they are using and then try and describe in generic
terms using fake names and paths. It is okay if it is all consistent,
but your descriptions keep changing.

> the django files themselves at  /mysite work just fine,

Can you clarify when you are talking about a URL or a directory. If a
directory, specify full path.

That you are mentioning '/mysite' here again is confusing because it
suggests a URL for a Django instance mounted at sub url of site, yet
you already seemed to have said you want to mount it at root of host,
ie., '/'.

> and
> were working before i attempted to set up the virtual host. and
> www.website.net was working just fine as well with the way the
> 's are currently set up, before the virtual host stuff was
> added.
>
> i figure i'm missing something before the first  that is
> causing the issue of the directory for the django apps not to be read.
> I do not want to set them up in the public_html directory as that is
> the main site directory, which if per chance i need to give someone
> access to that... i don't want them in the django directories at all.

It is unclear here whether you are talking about static files, eg.
images and stylesheets, or Django code. You should never stick Django
directory containing code inside of a Apache DocumentRoot directory
for a host. Your better choices are to copy the static file
directories into DocumentRoot or use a symlink to link them in from a
different location. Depending on Apache configuration you may need to
set FollowSymLinks option. Alternatively, use an Alias directive in
Apache to effectively mount them at required URL from some other
directory location. Either way, mod_python is a PITA in that you need
to have SetHandler None for the URL (Location) context where they are
when whole Django site is mounted at a parent URL to the static files.

> the server itself is a virtual server from godaddy running red hat 7
> w/ apache and mod_python.
>
> I was looking at a few pages and they mention DocumentRoot... should
> this be to /home/site1 or to the project files?

As I said above, you should never put Django code in DocumentRoot
because a mistake in Apache configuration can expose your source code
to download.

> how does PythonInterpreter need to be applied?

It doesn't if you are only hosting one Django site inside of a
VirtualHost.

Now, did you get rid of PythonOption to django.root which I said is
not needed if mounting Django at root of site. Be aware though that
that is an option only relevant to Django 1.0. Are you actually using
Django 1.0? If you are using older version of Django, then you aren't
reading the correct version of the documentation.

Problem now is that still not even clear what you actual problem is
any more. How about being very clear and give URLs for each request
you are making and state whether it works. Ie., does '/' work, does '/
images/...someimage.jpg' work, does some sub URL for part of your
application work? In other words, is the thing that doesn't work
static resources or dynamic resources? When you say you get nothing,
what do you mean by that, do you get a blank page, or simply not what
you expect?

If any don't work, is the error response a generic Apache error page
or a Django specific error page? Have you looked in the Apache error
logs to see if there are any Python error messages in there, or even
an indication that the Apache process has crashed with a segmentation
fault? Have you got DEBUG set to True for Django so that if Django is
generating the error that the error details are returned in the web
page?

Right now I can only guess at a few things. The first is django.root
as I mentioned, if you are indeed mounting Django at root of site. The
second is PythonPath doesn't also include Django instance directory in
addition to its parent. This latter will be an issue if in any part of
your code or urls.py file references stuff within the project without
explicitly referencing the site name.

To make any further guess you need to expand on the vague information
you have already provided as what constitutes don't work and what
exactly you were expecting to see.

BTW, it is presumed you properly restarted Apache between making
configuration changes.

Graham

> On Jan 3, 9:22 pm, Graham Dumpleton 
> wrote:
>
> > On Jan 4, 12:53 pm, garagefan  wrote:
>
> > > no, as then i would need to use, for example...www.website.net/mysite/

Re: python.conf question, multiple sites on same server?

2009-01-03 Thread garagefan

there is currently only one virtual host set up, for the site i'm
working on. I do not need anything to happen with the other url. my
django files are in a folder at the same level as the root folder of
the site.

i simply need a virtual host for www.website.net that sits at /home/
site1/ on my server that has a django directory at /home/site1/mysite
to work.  the django files themselves at  /mysite work just fine, and
were working before i attempted to set up the virtual host. and
www.website.net was working just fine as well with the way the
's are currently set up, before the virtual host stuff was
added.

i figure i'm missing something before the first  that is
causing the issue of the directory for the django apps not to be read.
I do not want to set them up in the public_html directory as that is
the main site directory, which if per chance i need to give someone
access to that... i don't want them in the django directories at all.

the server itself is a virtual server from godaddy running red hat 7
w/ apache and mod_python.

I was looking at a few pages and they mention DocumentRoot... should
this be to /home/site1 or to the project files?

how does PythonInterpreter need to be applied?

On Jan 3, 9:22 pm, Graham Dumpleton 
wrote:
> On Jan 4, 12:53 pm, garagefan  wrote:
>
> > no, as then i would need to use, for example...www.website.net/mysite/*
> > instead ofwww.website.net/*forthe various apps.
>
> If you are mounting it at root of web site, you should not be setting
> django.root with PythonOption directive for a start. You only need set
> django.root when mounted at a sub url. That you had set it gave the
> impression you wanted it mounted at a sub url.
>
> > as i said the locations worked perfectly before attempting to create
> > the virtual host. right now i need to have this virtual host point to
> > the correct website on my server.
>
> As I said, you need to provide more complete configuration which shows
> both Django sites and how you have set them up.
>
> If your VirtualHost containers are the same except for ServerName in
> each, then show that by providing the configurations for both, or be
> clear about that and state it rather than us having to assume what it
> all looks like.
>
> > would i change server name to be an ip address? as each website on my
> > server has a unique address, while having the same port? since 80 is
> > the open port for apache
>
> Show configurations for both VirtualHost's and then we may be able to
> answer.
>
> Graham
>
> > On Jan 3, 8:47 pm, Graham Dumpleton 
> > wrote:
>
> > > On Jan 4, 12:17 pm, garagefan  wrote:
>
> > > > I've read the documentation, and it doesn't seem clear enough, or
> > > > provide a fully working example?
>
> > > > i've copied what i have in my python.conf file, keep in mind that i
> > > > have removed site specific names and have made them generic
>
> > > > NameVirtualHost *:80
>
> > > > 
> > > >     ServerNamewww.website.net
>
> > > >     
>
> > > Presumably you mean /mysite here and not the root of the web server.
> > > This needs to match what you have set django.root to.
>
> > > Graham
>
> > > >         SetHandler python-program
> > > >         PythonHandler django.core.handlers.modpython
> > > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > >         PythonOption django.root /mysite
> > > >         PythonDebug On
> > > >         PythonPath "['/home/html'] + sys.path"
> > > >     
> > > >     
> > > >         SetHandler None
> > > >     
> > > >     
> > > >         SetHandler None
> > > >     
> > > > 
>
> > > > i get no python errors, however when i go to the site i receive
> > > > nothing. these locations worked previous to attempting to set up a
> > > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > > may be possible that the port is incorrect? in which case, i'm unsure
> > > > as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread Graham Dumpleton



On Jan 4, 12:53 pm, garagefan  wrote:
> no, as then i would need to use, for example...www.website.net/mysite/*
> instead ofwww.website.net/*for the various apps.

If you are mounting it at root of web site, you should not be setting
django.root with PythonOption directive for a start. You only need set
django.root when mounted at a sub url. That you had set it gave the
impression you wanted it mounted at a sub url.

> as i said the locations worked perfectly before attempting to create
> the virtual host. right now i need to have this virtual host point to
> the correct website on my server.

As I said, you need to provide more complete configuration which shows
both Django sites and how you have set them up.

If your VirtualHost containers are the same except for ServerName in
each, then show that by providing the configurations for both, or be
clear about that and state it rather than us having to assume what it
all looks like.

> would i change server name to be an ip address? as each website on my
> server has a unique address, while having the same port? since 80 is
> the open port for apache

Show configurations for both VirtualHost's and then we may be able to
answer.

Graham

> On Jan 3, 8:47 pm, Graham Dumpleton 
> wrote:
>
> > On Jan 4, 12:17 pm, garagefan  wrote:
>
> > > I've read the documentation, and it doesn't seem clear enough, or
> > > provide a fully working example?
>
> > > i've copied what i have in my python.conf file, keep in mind that i
> > > have removed site specific names and have made them generic
>
> > > NameVirtualHost *:80
>
> > > 
> > >     ServerNamewww.website.net
>
> > >     
>
> > Presumably you mean /mysite here and not the root of the web server.
> > This needs to match what you have set django.root to.
>
> > Graham
>
> > >         SetHandler python-program
> > >         PythonHandler django.core.handlers.modpython
> > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >         PythonOption django.root /mysite
> > >         PythonDebug On
> > >         PythonPath "['/home/html'] + sys.path"
> > >     
> > >     
> > >         SetHandler None
> > >     
> > >     
> > >         SetHandler None
> > >     
> > > 
>
> > > i get no python errors, however when i go to the site i receive
> > > nothing. these locations worked previous to attempting to set up a
> > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > may be possible that the port is incorrect? in which case, i'm unsure
> > > as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with send_mail and the string formatting operator

2009-01-03 Thread Karen Tracey
On Sat, Jan 3, 2009 at 8:48 PM, OwenK  wrote:

>
> I have a simple function for sending activation emails to new users,
> but it always raises a ValueError of "unsupported format character
> '/' (0x2f) at index 51". You can see the function at
> http://dpaste.com/105078/
> . the newuser argument is a user instance, and active_key is a string
> of length 25 (only alphanumeric). I'm pretty sure the bug's in line
> four, but I don't know what's wrong with it. Any ideas?
>

You haven't indicated what type the thing is you want inserted into your
string.  The interpreter  uses the character after the % (actually that's a
lie, there are a set of optional things that may come between the % and the
conversion type, see
http://docs.python.org/library/stdtypes.html#string-formatting-operationsfor
details) to determine if it's a string (%s) an integer (%d), etc.
Since
you say active_key is a string, that line should be:

'Click http://example.com/join/%s/";>here to authenticate.' %
active_key,

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



Re: Problems with send_mail and the string formatting operator

2009-01-03 Thread Malcolm Tredinnick

On Sat, 2009-01-03 at 17:48 -0800, OwenK wrote:
> I have a simple function for sending activation emails to new users,
> but it always raises a ValueError of "unsupported format character
> '/' (0x2f) at index 51". You can see the function at http://dpaste.com/105078/
> . the newuser argument is a user instance, and active_key is a string
> of length 25 (only alphanumeric). I'm pretty sure the bug's in line
> four, but I don't know what's wrong with it. Any ideas?

"Unsupported format character" always means you've forgotten to put
something after the '%' sign (in this case, Python is saying that it is
seeing '/' instead of a valid character). So look at your '%' character
and notice that you are missing, for example, a following 's' ("%s/...",
not "%/...").

Regards,
Malcolm


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



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread garagefan

i currently only have two sites, one is not being developed at this
time.. but w/o the virtual host that site displays the same apps and
info at it's url as the site i am working on, which i do not want to
happen. what i have copied for my virtual host is really everything i
have.

As i said, i have not been able to find much documentation on this so
i've been unable to mess around with it myself beyond this point (as
this is really only what the djangoproject site shows)

each site sits like so...

/home/(username)/

username being the base directory... so say

/home/site1/ and /home/site2/ both have a  /public_html/ directory in
them which the server reads as the base level for the site. but with
the locations set up in python.conf /mysite/, which is at the same
level as public_html in the site1 directory is being used for the
apps. location '/' results in being able to target the apps via the
first slash in the url after the site name, which is the desired
result.

however now, i get the apache works page at "www.website.net" and page
not founds on anything else that worked previously to attempting to
set up the virtual host

On Jan 3, 8:50 pm, Graham Dumpleton 
wrote:
> BTW, with mod_python, if trying to host multiple Django sites inside
> of same VirtualHost, you must set PythonInterpreter directive
> differently for each.
>
> You really need to provide a more complete example showing all the
> sites and how they site with respect to each other and the VirtualHost
> in the configuration.
>
> Graham
>
> On Jan 4, 12:47 pm, Graham Dumpleton 
> wrote:
>
> > On Jan 4, 12:17 pm, garagefan  wrote:
>
> > > I've read the documentation, and it doesn't seem clear enough, or
> > > provide a fully working example?
>
> > > i've copied what i have in my python.conf file, keep in mind that i
> > > have removed site specific names and have made them generic
>
> > > NameVirtualHost *:80
>
> > > 
> > >     ServerNamewww.website.net
>
> > >     
>
> > Presumably you mean /mysite here and not the root of the web server.
> > This needs to match what you have set django.root to.
>
> > Graham
>
> > >         SetHandler python-program
> > >         PythonHandler django.core.handlers.modpython
> > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >         PythonOption django.root /mysite
> > >         PythonDebug On
> > >         PythonPath "['/home/html'] + sys.path"
> > >     
> > >     
> > >         SetHandler None
> > >     
> > >     
> > >         SetHandler None
> > >     
> > > 
>
> > > i get no python errors, however when i go to the site i receive
> > > nothing. these locations worked previous to attempting to set up a
> > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > may be possible that the port is incorrect? in which case, i'm unsure
> > > as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread garagefan

no, as then i would need to use, for example... www.website.net/mysite/*
instead of www.website.net/* for the various apps.

as i said the locations worked perfectly before attempting to create
the virtual host. right now i need to have this virtual host point to
the correct website on my server.

would i change server name to be an ip address? as each website on my
server has a unique address, while having the same port? since 80 is
the open port for apache

On Jan 3, 8:47 pm, Graham Dumpleton 
wrote:
> On Jan 4, 12:17 pm, garagefan  wrote:
>
> > I've read the documentation, and it doesn't seem clear enough, or
> > provide a fully working example?
>
> > i've copied what i have in my python.conf file, keep in mind that i
> > have removed site specific names and have made them generic
>
> > NameVirtualHost *:80
>
> > 
> >     ServerNamewww.website.net
>
> >     
>
> Presumably you mean /mysite here and not the root of the web server.
> This needs to match what you have set django.root to.
>
> Graham
>
> >         SetHandler python-program
> >         PythonHandler django.core.handlers.modpython
> >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >         PythonOption django.root /mysite
> >         PythonDebug On
> >         PythonPath "['/home/html'] + sys.path"
> >     
> >     
> >         SetHandler None
> >     
> >     
> >         SetHandler None
> >     
> > 
>
> > i get no python errors, however when i go to the site i receive
> > nothing. these locations worked previous to attempting to set up a
> > virtual host. i assume *:80 is the port? in which case, i suppose it
> > may be possible that the port is incorrect? in which case, i'm unsure
> > as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread Graham Dumpleton

BTW, with mod_python, if trying to host multiple Django sites inside
of same VirtualHost, you must set PythonInterpreter directive
differently for each.

You really need to provide a more complete example showing all the
sites and how they site with respect to each other and the VirtualHost
in the configuration.

Graham

On Jan 4, 12:47 pm, Graham Dumpleton 
wrote:
> On Jan 4, 12:17 pm, garagefan  wrote:
>
> > I've read the documentation, and it doesn't seem clear enough, or
> > provide a fully working example?
>
> > i've copied what i have in my python.conf file, keep in mind that i
> > have removed site specific names and have made them generic
>
> > NameVirtualHost *:80
>
> > 
> >     ServerNamewww.website.net
>
> >     
>
> Presumably you mean /mysite here and not the root of the web server.
> This needs to match what you have set django.root to.
>
> Graham
>
> >         SetHandler python-program
> >         PythonHandler django.core.handlers.modpython
> >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >         PythonOption django.root /mysite
> >         PythonDebug On
> >         PythonPath "['/home/html'] + sys.path"
> >     
> >     
> >         SetHandler None
> >     
> >     
> >         SetHandler None
> >     
> > 
>
> > i get no python errors, however when i go to the site i receive
> > nothing. these locations worked previous to attempting to set up a
> > virtual host. i assume *:80 is the port? in which case, i suppose it
> > may be possible that the port is incorrect? in which case, i'm unsure
> > as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problems with send_mail and the string formatting operator

2009-01-03 Thread OwenK

I have a simple function for sending activation emails to new users,
but it always raises a ValueError of "unsupported format character
'/' (0x2f) at index 51". You can see the function at http://dpaste.com/105078/
. the newuser argument is a user instance, and active_key is a string
of length 25 (only alphanumeric). I'm pretty sure the bug's in line
four, but I don't know what's wrong with it. Any ideas?

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



Re: python.conf question, multiple sites on same server?

2009-01-03 Thread Graham Dumpleton



On Jan 4, 12:17 pm, garagefan  wrote:
> I've read the documentation, and it doesn't seem clear enough, or
> provide a fully working example?
>
> i've copied what i have in my python.conf file, keep in mind that i
> have removed site specific names and have made them generic
>
> NameVirtualHost *:80
>
> 
>     ServerNamewww.website.net
>
>     

Presumably you mean /mysite here and not the root of the web server.
This needs to match what you have set django.root to.

Graham

>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonOption django.root /mysite
>         PythonDebug On
>         PythonPath "['/home/html'] + sys.path"
>     
>     
>         SetHandler None
>     
>     
>         SetHandler None
>     
> 
>
> i get no python errors, however when i go to the site i receive
> nothing. these locations worked previous to attempting to set up a
> virtual host. i assume *:80 is the port? in which case, i suppose it
> may be possible that the port is incorrect? in which case, i'm unsure
> as to where to check this... i assume under the apache conf file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



python.conf question, multiple sites on same server?

2009-01-03 Thread garagefan

I've read the documentation, and it doesn't seem clear enough, or
provide a fully working example?

i've copied what i have in my python.conf file, keep in mind that i
have removed site specific names and have made them generic


NameVirtualHost *:80


ServerName www.website.net


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/home/html'] + sys.path"


SetHandler None


SetHandler None



i get no python errors, however when i go to the site i receive
nothing. these locations worked previous to attempting to set up a
virtual host. i assume *:80 is the port? in which case, i suppose it
may be possible that the port is incorrect? in which case, i'm unsure
as to where to check this... i assume under the apache conf file?


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



Re: "Practical Django Projects" -- browsing by tag

2009-01-03 Thread waltbrad

> On Jan 1, 3:23 pm,waltbrad wrote:
>
> > Okay, I'm getting closer.

Well, I got all my templates to work.  Could someone tell me if it was
just me missing something or if there are mistakes in that book in
regards to tagging?  I've been following along with the Hedged Down
website and they have said nothing about that. But in the
link_detail.html template in the book it says this:

{% if object.tags.count %}
 This link is tagged with
 {% for tag in object.categories.all %}
 {{ tag.title }}
 {% if forloop.last %}{% else %}
 {% ifequal forloop.revcounter0 1 %}and {% else
%}, {% endifequal %}
 {% endif %}
 {% endfor %}

{% else %}
This link doesn't have any tags.

Now when I used this none of the tags would show up on the pages. I
always got "This link doesn't have any tags".
Then it hit me that the Link model doesn't have a category field. So
the "for tag in object.categories.all" code wouldn't work.

But, ultimately, what I had to do was load tagging_tags into the
template and use the template tags that are related to the django-
tagging application.  So, the code for having the template distinguish
between a link and an entry tag went like this:


 {% load tagging_tags %}
 {% for item in object_list %}
  {% tagged_objects item in coltrane.Entry as goods %}
  {% if goods %}
   
 
{{ item.name }}
   
  {% else %}

  
{{ item.name }}

  {% endif %}
  {% endfor %}


I also had to load tagging_tags into the link_detail.html and work
with those tags to get the tags to show up for that page.

But at this point, I no longer need any help, but I sure would like to
know why nobody else mentioned this when blogging about this book.
And if there was an easier way to do this then the way I chose.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Comma or Currency formats

2009-01-03 Thread David

On Jan 3, 5:33 am, phoebebright  wrote:
> On Jan 2, 7:06 pm, Shay Ben Dov  wrote:
>
> > Hi,
>
> > I'm using GAE and wondering how come there is no comma insertion 
> > orcurrencyformating of floating numbers like:
>
> > {{ value|floatformat:2 }} built_in filter
>
> > Shay
>
> You could 
> tryhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#floatformat
> o rhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#stringfo...

If the reference to "comma insertion" is for commas as 1000s
separators, we use the following addition to contrib.humanize.py:

def floatcomma(value):
"""
Converts a float to a string containing commas every three digits.
For example, 3000.65 becomes '3,000.65' and -45000.00 becomes
'-45,000.00'.
"""
orig = force_unicode(value)
intpart, dec = orig.split(".")
intpart = intcomma(intpart)
return ".".join([intpart, dec])
floatcomma.is_safe = True
register.filter(floatcomma)

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



Re: getting "duplicate key violates unique constraint" error from form even with "unique_together" in model

2009-01-03 Thread hotani

well, doy. I just noticed that when attempting to create a form from a
model I called forms.Form instead of ModelForm. I'll mess with it some
more and see what happens.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Comments Framework and Authentication

2009-01-03 Thread Tim

Hi all -

I am having a bit of difficulty with the Django comments framework -
more specifically, dealing with comment modifications by site users as
well as moderators.

Basically, I have a site in which users can post comments (using the
out-of-the-box commenting framework). I'd like to have a flexible
comment deletion environment in which comments could be deleted by the
user associated with the model attached to the comment or the original
poster of the comment - e.g., for a blog posting, I'd like the blog
writer to be able to delete inappropriate or offensive comments, but
I'd also like the commenter to be able to delete a comment they made
if they had second thoughts about it.

The commenting framework supports basic permissions for a user to
moderate comments via the "perms.comment.can_delete" value. However, I
obviously don't want to grant this permission to every user; this
would mean a malicious user could just delete comments at will whether
they belonged to them or not. I believe it's possible to do all the
logic to find out if a user is allowed to delete a comment in a custom
view and then forward the request to the official deletion view - but
then I still run into the check if the user is authorized to delete
comments or not. I am really loath to change the core commenting code
itself. Is there a better way to do it?

Here's a quickly hacked together template that kind of shows what I'm
trying to do (along with all my debugging junk):


{% if perms.comment.can_delete %}
You can delete comments.
{% else %}
You cannot delete comments.
{% endif %}
{% ifequal comment.user_id user_profile_id %}
...display a button to delete...
{% endifequal %}
{% if my_page %}
...display a button to delete...
{% endif %}


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



Flat-file Field

2009-01-03 Thread Randy

I am trying to figure out how to create a model field that doesn't
pull from the database but instead pulls from the file system, shows
it in the forms as a Textarea, then just saves it back to file system
when the model is saved.

In my mind it seems pretty simple. I have read the custom models page
in the documentation but keep running around in circles. I can think
of two ways to do it. Write a custom object that handles it or somehow
extend the FileField. It seems that the FileField option would be the
better of the two options. I can get the form to show a textarea but
have no idea what I need to override to get the value of the textarea
to be populated with the contents of a file and then have that pulled
from the form to be put back into a file.

Any ideas? Has this already been written somewhere? I'm just getting
started with python and django so if there are resources that I missed
please let me know.

Thanks,

Randy

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



Re: getting "duplicate key violates unique constraint" error from form even with "unique_together" in model

2009-01-03 Thread hotani

Thanks Karen, that fixes the problem in the django admin. At least now
I know that everything is ok on the database and model fronts.
However, in my own form it is still not validating this relationship.

Here is what I have right now:

in a forms.py file there is a base form for the Case model:
--
class CaseFormBase(forms.Form):
office = forms.ModelChoiceField(widget=forms.HiddenInput,
queryset=Office.objects.all())
case_no= forms.CharField(max_length=20, label="Case No.")
...
class Meta:
model=Case
--

This base form is used for other forms which need to dynamically build
their option lists. This is the form for adding a new case (in a file
called 'cases.py'):
--
from app.forms import CaseFormBase
class NewCaseForm(CaseFormBase):
county = forms.ModelChoiceField(queryset=County.objects.filter
(activecounties__office=office, activecounties__active=True ))
...

# form is validated and processed here:
if request.method=='POST':
f = NewCaseForm(request.POST)
if f.is_valid():
new_case = (...)
new_case.save()
--

Since this does not seem to be working, for now I've gone back to my
clean method which manually checks for duplicates. I'd rather do it
the 'right' way by using 'unique_together' but it doesn't seem to be
cooperating with my setup.


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



Re: Ten reasons why couchdb is better than (off topic)

2009-01-03 Thread Petite Abeille


On Jan 3, 2009, at 11:47 PM, Masklinn wrote:

> It's worse than comparing apples and oranges, it's comparing apples  
> and potatoes.

Except if you are French... as potatoes are named "pomme de terre"...  
literally "ground apple"... :P

http://en.wikipedia.org/wiki/Potato#Etymology

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/

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



Re: Ten reasons why couchdb is better than (off topic)

2009-01-03 Thread Masklinn

On 3 janv. 09, at 22:08, mobil  wrote:
> Ten reasons why couchdb is better than (off topic)
>
>
> http://pylab.blogspot.com/2009/01/ten-reasons-why-couchdb-is-better-than.html
>
> Guys I wrote up a small list of reasons why i think couchdb is way
> bettter than mysql. Do let me know what you think
>
Couch and mysql being completely different techs solving completely  
different problems and answering different needs/requirements, I think  
any attempt to show that one is inherently better than the other is  
deeply misguided unless it's based on quite precise (and coherent)  
usage patterns and scenarios.

It's worse than comparing apples and oranges, it's comparing apples  
and potatoes.

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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Ramiro Morales

On Fri, Jan 2, 2009 at 8:03 AM, Friendless  wrote:
>
> I tried to report a bug anonymously and got told I was spam, so I
> signed up, got the email, activated the account, and still can't log
> in and still can't report the bug. I've been using Django 30 minutes
> and I'm already frustrated!

I've just took 15 seconds and followed the same process creating a test user
and I can login perfectly to the code.djangoproject.com site.

Something slightly weird: after activating the account, I followed
the link to login for the first time, once I entered the user
name and password I got redirected to the djangoproject.com
site and going back to code.djangoproject still didn't show me
as logged in.

So I had to log in again using the 'Login' link located at the upper
right corner of the page (in the light green strip), that
worked right away.

Regards,

-- 
 Ramiro Morales

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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Friendless

I'm using MySQL 5.0.51a on Ubuntu Hardy Heron.

As you say, this is a somewhat obscure bug. I guess the question is,
do you want your product to work or not? You've acknowledged it's a
valid problem. I tried to use Django 0.92 when it was the latest
version and inspectdb fell over. I can't remember whether it was the
same problem. Anyway, at the time I just lost interest and ignored
Django for a year. So I'd gone to the trouble of installing the
product, I'd bought and read the book, and when I went to use it it
fell over on the very first thing I tried to do. That's a pretty good
way to stop users from getting very far with your product. But hey,
you develop your product how you like.

Yes, my fix was fragile. I didn't have the inclination to spend a lot
of time fixing a product which until then had done nothing for me. I
presume there are people who know a whole lot more about the code than
I do who can maybe even log into the website.

mysql> select column_name, referenced_table_name,
referenced_column_name from information_schema.key_column_usage where
table_name = 'expansions' and table_schema = DATABASE() and
referenced_table_name is not null and referenced_column_name is not
null;
+-+---++
| column_name | referenced_table_name | referenced_column_name |
+-+---++
| basegame| games | BGGID  |
| expansion   | games | BGGID  |
+-+---++
2 rows in set (0.14 sec)

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



Re: How to populate a form field with a Select widget

2009-01-03 Thread phoebebright

Following on from this example, I am trying to use values from a table
to populate a choicefield (and been at it for 2 days trying every
method I can find in google)

Clearly from the output below, I am creating the wrong kind of data
type, but don't know how to change it:


THIS VERSION WORKS:
>>> CHOICES = ( ('P', 'Pending'), ('A', 'Active'), ('D', 'Done'))
>>> print CHOICES
(('P', 'Pending'), ('A', 'Active'), ('D', 'Done'))
>>> fuel_type = forms.ChoiceField(choices=CHOICES,widget=forms.Select ())
>>> print fuel_type.choices
[('P', 'Pending'), ('A', 'Active'), ('D', 'Done')]
>>>

THIS VERSION DOES NOT:
(fails with Caught an exception while rendering: need more than 1
value to unpack)

>>> CHOICES = Car.objects.all().values('fuel_type','fuel_type').distinct()
>>> print CHOICES
[{'fuel_type': u'Petrol'}, {'fuel_type': u'Diesel'}]
>>> fuel_type = forms.ChoiceField(choices=CHOICES,widget=forms.Select ())
>>> print fuel_type.choices
[{'fuel_type': u'Petrol'}, {'fuel_type': u'Diesel'}]


Any help as to the best way of doing this would be great - I also need
to add 'Any Fuel' as the first option as this is for a search form.


On Dec 29 2008, 11:10 am, Polat Tuzla  wrote:
> A formatting error occurred while I did my previous post.
> Please make sure that you notice the parentheses at the last line of
> the code snippet, which were actually meant to be  at the end of the
> previous line.
>
> Regards,
> Polat
>
> On Dec 29, 1:03 pm, Polat Tuzla  wrote:
>
> > You can do it as follows:
>
> >     class MyForm:
> >         CHOICES = ( ('P', 'Pending'), ('A', 'Active'), ('D', 'Done'))
> >         status = forms.ChoiceField(choices=CHOICES,widget=forms.Select
> > ())
>
> > Regards,
> > Polat
>
> > On Dec 29, 5:13 am, "Aaron Lee"  wrote:
>
> > > I would like to populate aformfield which uses aSelectwidget with
> > > choices in views.py.
> > > I understand I can pass the initial arg to theformbut I couldn't find the
> > > correct value to pass.
>
> > > The choices is a list of tuple
> > > CHOICES = ( ('P', 'Pending'), ('A', 'Active'), ('D', 'Done'))
>
> > > Any hints?
>
> > > -Aaron
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Form Media

2009-01-03 Thread tom.s.macken...@gmail.com

I dont believe I missed this...
It wasnt showing because the browser was interpreting it as a html
tag..
haha. nm.

On Jan 3, 11:52 am, "tom.s.macken...@gmail.com"
 wrote:
> Hello,
>
> I am trying incorporateFormMediain my forms and I'm having some
> trouble interpreting how this is done 
> via,http://docs.djangoproject.com/en/dev/topics/forms/media/
>
> My goal is to use the admin/media/css/form.css in my template.
>
> Here is myform:
>
> class ApprovalForm(ModelForm):
>     class Meta:
>         model = Approval
>         fields = ('approval_type','approved','url','comment')
>
>     classMedia:
>         css = {
>             'all': ('layout.css','form.css',)
>     }
>
> I send myformto my template and try to reference,form.mediabut I dont have 
> any values.
>
> In my template I do this just to test.FormMedia: {{form.media}}
>
> I get no output...
>
> I did a test in the shell and iform.mediagets assigned correctly.
>
> any help on where I'm going wrong is appreciated!
>
> Tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Ten reasons why couchdb is better than (off topic)

2009-01-03 Thread mobil

Ten reasons why couchdb is better than (off topic)


http://pylab.blogspot.com/2009/01/ten-reasons-why-couchdb-is-better-than.html

Guys I wrote up a small list of reasons why i think couchdb is way
bettter than mysql. Do let me know what you think




--
Gpirate the top torrent search engine
http://gpirate.com

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



Show/Hide fields depending on another class field value

2009-01-03 Thread Patrick

Suppose I have something like this in models.py:

class EquipmentModel(models.Model):
...
wireless = booleanField();
manageable = booleanField();

class Equipment(models.Model):
equipment_model = ForeignKey(EquipmentModel)
...
ssid = charField(...)
ip = charField(...)

Is it possible, while adding an equipment in the admin page, to have
the fields SSID, or IP, disabled or hidden, based on the value of
'wireless' and 'manageable'?

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



RELEASED: django-batchimport 0.1

2009-01-03 Thread Keyton Weissinger

Greetings All,

I've just finished the 0.1 version of django-batchimport and have
released it on code.google.com.

Go to http://code.google.com/p/django-batchimport/ for more
information (and SVN checkout).

This application can be added to any django project to give it batch
import capability via uploaded Microsoft Excel file (or other formats
saved as XLS). This allows for someone with a spreadsheet of, say,
users to easily upload it and add it all at once.

While batch importing in django is easy to do via fixtures, this
reusable app is aimed at being for non-developer end users of your web
application.

The process by which this app does it's work is completely dynamic,
inspecting both the spreadsheet and the django models dynamically at
runtime. No prior knowledge of either the model into which the user is
importing or the spreadsheet uploaded is required.

The only prerequisite is John Machin's xlrd library (http://
www.lexicon.net/sjmachin/xlrd.htm), python 2.5+, and django 1.0+.

See the website for full details and please drop me a note on the
django-batchimport-users group if you have questions or comments.

Thank you.

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



Custom SQL not installed while running test suite

2009-01-03 Thread Tyler Erickson


I have an app that provides some custom SQL statements for populating the
test database (located in /particles/sql/particle.sql).  The app's database
table (particles_particle) is populated correctly when I run the test case
for the app (i.e. python manage.py test particles) but the database table is
not populated when I run the entire test suite (i.e. python manage.py test). 
The testing output seems to indicate that the custom SQL was loaded
('Installing custom SQL for particles.Particle model') but no records appear
in the database and a test that verifies the number of expected records
fails.

The testing output is included below.
Any ideas on why the custom SQL records are not appearing?  

- Tyler


taeri...@latituded830b:djangosite$ python manage.py test particles
createlang -d test_carbon_sql -U django_test plpgsql
psql -d test_carbon_sql -U django_test -f
"/usr/local/postgis/1.3.3/share/lwpostgis.sql"
psql -d test_carbon_sql -U django_test -f
"/usr/local/postgis/1.3.3/share/spatial_ref_sys.sql"
Creation of spatial database test_carbon_sql successful.
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table particles_particle
Installing custom SQL for particles.Particle model
Installing index for auth.Permission model
Installing index for auth.Message model
Installing index for admin.LogEntry model
..Number of particle records: 7
..
--
Ran 4 tests in 0.075s

OK
Destroying test database...
taeri...@latituded830b:djangosite$ python manage.py test
createlang -d test_carbon_sql -U django_test plpgsql
psql -d test_carbon_sql -U django_test -f
"/usr/local/postgis/1.3.3/share/lwpostgis.sql"
psql -d test_carbon_sql -U django_test -f
"/usr/local/postgis/1.3.3/share/spatial_ref_sys.sql"
Creation of spatial database test_carbon_sql successful.
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table particles_particle
Installing custom SQL for particles.Particle model
Installing index for auth.Permission model
Installing index for auth.Message model
Installing index for admin.LogEntry model
...Number of particle records: 0
F...
==
FAIL: test_kml_placemark (djangosite.particles.tests.ParticleTestCase)
--
Traceback (most recent call last):
  File
"/home/terickson/current_work/kml_competition/hg/carbon/djangosite/../djangosite/particles/tests.py",
line 64, in test_kml_placemark
self.assertEquals(Particle.objects.all().count(),7)
AssertionError: 0 != 7

--
Ran 23 tests in 5.961s

FAILED (failures=1)
Destroying test database...
taeri...@latituded830b:djangosite$ 

-- 
View this message in context: 
http://www.nabble.com/Custom-SQL-not-installed-while-running-test-suite-tp21267450p21267450.html
Sent from the django-users mailing list archive at Nabble.com.


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



Form Media

2009-01-03 Thread tom.s.macken...@gmail.com

Hello,

I am trying incorporate Form Media in my forms and I'm having some
trouble interpreting how this is done via, 
http://docs.djangoproject.com/en/dev/topics/forms/media/

My goal is to use the admin/media/css/form.css in my template.

Here is my form:

class ApprovalForm(ModelForm):
class Meta:
model = Approval
fields = ('approval_type','approved','url','comment')

class Media:
css = {
'all': ('layout.css','form.css',)
}

I send my form to my template and try to reference,
form.media but I dont have any values.

In my template I do this just to test.
Form Media: {{ form.media }}

I get no output...

I did a test in the shell and iform.media gets assigned correctly.

any help on where I'm going wrong is appreciated!

Tom



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



Re: Tutorial Problem

2009-01-03 Thread rvwilliams

Absolutely certain!


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



Redirect parent from within iframe without losing session

2009-01-03 Thread Berco Beute

My page shows a (logged in) user an iFrame but when the iframe
redirects the browser after it's done, the session is lost. The
redirecting of the parent (by the iframe) is done as follows:

=


function load() {
parent.location.href='http://localhost:8000/somewhere';
}


==

Is there a way to keep the session alive (e.g. keep the user logged
in)?

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



Re: getting "duplicate key violates unique constraint" error from form even with "unique_together" in model

2009-01-03 Thread Karen Tracey
On Fri, Jan 2, 2009 at 2:45 PM, hotani  wrote:

>
> Could this be a problem with the editable=False setting?
>

Yes, sorry, I did not notice you had set that on one of the fields involved
in the unique check.


> The record I am attempting to duplicate is a duplicate office/county/
> case_no entry. However, it is also a duplicate county/case_no. It
> seems like even with the form validation ignoring 'office' it would
> catch the county/case_no dupe?
>

No, if any of the fields involved in unique_together are not present in
cleaned_data during form validation (the editable=False one is not) then the
check cannot be performed.  county/case_no may be a dupe but without a value
to check for office the form validation cannot determine if the three
together are going to be unique.


> I tried changing the Meta class to unique_together=
> ("county","case_no") but no change.
>

I don't understand this.  When I try your model code and only specify these
two in unique_together I get a form-level validation ('Case with this County
and Case no already exists.') error trying to specify a duplicate
county/case_no.

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



ipdb causing problems with docstring tests of default apps

2009-01-03 Thread Tyler Erickson


I have noticed that running unit tests for my own apps can interfere with the
testing of some of the django internal apps (auth, sessions, sites, etc.). 
I have been using ipdb to debug and to help write views and tests, and it
appears that importing the ipdb module (import ipdb) causes many of the
docstring tests of the default apps to fail.

Anyone know why this happens?  I would like to continue to use ipdb (it is
quite useful), but I also would like to be able to include the docstring
tests for the default apps in my testing suite.

- Tyler 
-- 
View this message in context: 
http://www.nabble.com/ipdb-causing-problems-with-docstring-tests-of-default-apps-tp21266209p21266209.html
Sent from the django-users mailing list archive at Nabble.com.


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



Re: Are Dynamic fields possible?

2009-01-03 Thread Matias Surdi

I've done it, although it was not a trivial task.

This helped me a lot:

http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/



Xan wrote:
> Hi,
> 
> I just want to know if django support dynamic fields, that is the
> option of not specied the type of field in the model and that user
> could specify in application.
> 
> I think for examples about an application for doing notes. In one
> note, one want to have: title, body, media, etc. but the number of
> fields (and its type) is variable. What about something like:
> 
> class Note(models.Note):
> title = models.CharField(max_length=200)
> anything = models.ManyToManyField(DynamicField)
> 
> and when user create a class specifies title and adds want he/she
> wants (body, pictures, etc. with the type of the field).
> 
> Is it possible?
> Thanks a lot,
> Xan.
> 
> PS: Happy new year.
> > 
> 


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



Are Dynamic fields possible?

2009-01-03 Thread Xan

Hi,

I just want to know if django support dynamic fields, that is the
option of not specied the type of field in the model and that user
could specify in application.

I think for examples about an application for doing notes. In one
note, one want to have: title, body, media, etc. but the number of
fields (and its type) is variable. What about something like:

class Note(models.Note):
title = models.CharField(max_length=200)
anything = models.ManyToManyField(DynamicField)

and when user create a class specifies title and adds want he/she
wants (body, pictures, etc. with the type of the field).

Is it possible?
Thanks a lot,
Xan.

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



custom field value representation

2009-01-03 Thread Matias Surdi

Hi,

Suppose I have the following model:

class Document(BaseModel):
 name = models.CharField(max_length=150,blank=True)
 description = models.TextField(blank=True)
 file = 
Models.FileField(upload_to="data/documentation/document/%Y/%m/%d",blank=True)


And suppose I've a model I created through the admin interface and 
uploaded a file named "document1.pdf"

Then, when modifying this database entry (in admin->change_form) I see 
the previous value as data/documentation/document/2009/01/03/document1.pdf"

Is there any way to get this value shown as just "document1.pdf" without 
the relative path?.. What i want, is to hide to the end user the 
filesystem location of the uploaded file.

I've accomplished this in the change_list by defining a custom method on 
the model that returns just the file name.

Thank you very much.


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



Re: Link on static HMTL not clickable

2009-01-03 Thread SG_Muse

Btw, maybe useful :) My urls.py:


from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^reco/', include('reco.foo.urls')),
(r'^general', direct_to_template, {'template':
'project_gi.html'}),
(r'^access',  direct_to_template, {'template':
'project_access.html'}),
# Uncomment the admin/doc line below and add
'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root),
)

if settings.DEBUG:
urlpatterns += patterns('',
(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Link on static HMTL not clickable

2009-01-03 Thread SG_Muse

Hello :)

Once again I would like you to ask you for your help. I designed two
static pages, which I want to link to eachother. Both pages are
viewable, when I explicitly change the URL in the adress-bar. However,
I cannot navigate to the other static page by means of the (href) link
on the first page (or the other way around).
The relevant part of the xHMTL file for my question looks like this:

  
  

  General
  Access
  Process
  Visualize

  
  

I looked into auto-escaping, that didn't solve it. So, i'm a bit lost
atm

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



Re: Migrating MySQL -> Postgre, any working solutions?

2009-01-03 Thread alex.gay...@gmail.com

Not the most exciting, but you could always use the orm to pull data
out of the old db and thenswl to put it into the new one(or vice
versa).

On Jan 3, 4:10 am, Szymon  wrote:
> Hello,
>
> I've found in archives message:
>
> > Check out django_extensions 
> > app,http://code.google.com/p/django-command-extensions/.
> > It has a command, dumpscript [...]
>
> It takes ages to complete. I've tried that method yesterday. I've
> turned off my web server and ran that command. After 6 hours it wasn't
> completed. (~1 GB database)
>
> So there is any other working solutions for migrating MySQL ->
> Postgre?
>
> Regards,
> Szymon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is it possible to provide initial data for a model with a foreign key to User model?

2009-01-03 Thread Russell Keith-Magee

On Sat, Jan 3, 2009 at 3:01 AM, adrian  wrote:
>
>
> I happen to have a bunch of models that all have foreign keys, but
> there is an order in which they could all be initialized.   I have
> figured out how to initialize the built-in User model using Json data,
> but I can't initialize any models that refer to it using a foreign
> key.  Is this possible and if so how?

Yes, it is possible. If you have a model something like:

class Person(Model):
   user = ForeignKey(User)
   name = CharField(...)

this will serialize something like:

{
"model": "myapp.person',
"pk": 1,
"fields": {
"user": 3,
"name": "Fred"
}
}

The reference to a user is just the primary key of the object you want
to refer to. If you want a more comprehensive example using your own
models, try creating some instances using the Python API, then use the
manage.py dumpdata command to produce sample fixtures.

Generally speaking, you don't need to worry about the order of
initialization. In your fixture, you can define the Person then the
User, or the User and then the Person - it doesn't matter.

If you're using SQLite or MySQL with MyISAM tables, there is no
referential integrity to worry about, so you can create a Person that
refers to a User that doesn't exist yet. As long as you eventually
create the User, you won't have any problems.

If you're using Postgres, all the fixtures are loaded in a
transaction, and referential integrity isn't checked until the end of
the transaction. As long as the Person and the User are both loaded at
the end of fixture loading, the order in which they are created
doesn't matter.

The only exception to this rule is MySQL with InnoDB tables - which,
because of its retarted referential integrity, insists on checking
references at the end of every commit, rather than at the end of the
transactional block. This means that you have to manually check that
the fixture with an ordering such that the User is loaded before the
Person.

Until MySQL fixes its referential integrity rules for InnoDB, this
limitation can't be avoided in the general case. Any form of circular
reference between models will always pose difficulties - there is no
way to provide an ordering that is guaranteed to load successfully.

Yours,
Russ Magee %-)

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



Re: Comma or Currency formats

2009-01-03 Thread phoebebright



On Jan 2, 7:06 pm, Shay Ben Dov  wrote:
> Hi,
>
> I'm using GAE and wondering how come there is no comma insertion 
> orcurrencyformating of floating numbers like:
>
> {{ value|floatformat:2 }} built_in filter
>
> Shay

You could try
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#floatformat
or
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#stringformat

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



Migrating MySQL -> Postgre, any working solutions?

2009-01-03 Thread Szymon

Hello,

I've found in archives message:

> Check out django_extensions app, 
> http://code.google.com/p/django-command-extensions/.
> It has a command, dumpscript [...]

It takes ages to complete. I've tried that method yesterday. I've
turned off my web server and ran that command. After 6 hours it wasn't
completed. (~1 GB database)

So there is any other working solutions for migrating MySQL ->
Postgre?

Regards,
Szymon

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



Re: Tutorial Problem

2009-01-03 Thread johan
I just started using Django as well
Are you sure you have not made any changes to your settings file?
Only a guess!

2009/1/2 rvwilliams 

>
> Hi
>
> I'm just getting started on django and I'm using a Windows Vista
> version.  Yesterday I completed about half of the tutorial without too
> much difficulty.  Now I'm trying to carry on from where I stopped.
> The first thing I need to do is to restart the test server, so I go
> into the 'mysite' folder and type "python manage.py runserver".  This
> fails with this traceback
> Traceback (most recent call last):
>  File "manage.py", line 11, in 
>execute_manager(settings)
>  File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 338, in execute_manager
>setup_environ(settings_mod)
>  File "C:\Python26\Lib\site-packages\django\core\management
> \__init__.py", line
> 316, in setup_environ
>project_module = __import__(project_name, {}, {}, [''])
> ImportError: No module named mysite
>
> I haven't changed anything from yesterday and I just can't work out
> why the server can't start again.  In fact if I try anything with
> manage.py, I get the same traceback.
>
> Can someone help me get back on track?
>
> Thanks.
>
> Richard Williams.
>
> >
>

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



Re: swapping out request.user in views

2009-01-03 Thread join.toget...@gmail.com

I agree that hacking request.user is a bad idea here. Write a function
for your view that returns data for a given user ID, then call it with
the owner or visitor's ID. I would also have two separate views unless
what the users are doing is very similar.

On Jan 2, 5:54 am, bruno desthuilliers 
wrote:
> On 1 jan, 23:30, nbv4  wrote:
>
>
>
> > I have a webapp that is accessed by the following urls (among others):
>
> > example.com/foobar-page-23
> > example.com/preferences
> > example.com/barfoo
>
> > etc.
>
> > When these URL's are access, the page is displayed using data from the
> > user who is logged in via request.user.
>
> > I also want it so the user can link others via:
>
> > example.com/share-34-gHy6GdY/foobar-page-23
> > example.com/share-34-gHy6GdY/barfoo
>
> > where 34 is the user_id and the stuff after the dash is just 34 ran
> > through a sha1-type hash to provide some simple security. This page
> > will display data as if request.user is user #34, except of course
> > request.user.is_authenticated() will return false, and the widgets for
> > changing data will be hidden in the template, and the navigation links
> > will not display "preferences" and the link.
>
> > I'm just wondering whats the best way to go about this? Am I going to
> > have to write code into each view that substitutes request.user with
> > User(pk=34), or should I make a separate view for the sharing
> > functionality that passes a modified 'request' object to the other
> > view? How would 'yall django experts go about attacking this one?
>
> (looks like my previous answer got lost so I repost it)
>
> What you really have here is a "visitor" (request.user) and an
> "owner" (here user #34) - which be the same user or not. So it might
> be better to reflect this in your code instead of hacking
> request.user. Then instead of testing whether request.user is
> authenticated, you test if request.user == owner. wrt/ your urls/
> views, it's just a matter of making the user_id part optional, and
> using request.user as owner if no user_id is provided.
>
> My 2 cents...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: I18n when using standalone templates

2009-01-03 Thread Iwan Vosloo

On Sat, 2009-01-03 at 13:23 +1100, Malcolm Tredinnick wrote:
> Dictionary updates are safe in Python.

Oh, I see, because of the GIL...  Thanks.
-i


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