Editing a many to many field in a save method

2010-11-30 Thread When ideas fail
Hi, I've got the following model and I want it so that each delivery has a default category of undefined class Delivery(models.Model): . categories = models.ManyToManyField(Category, blank = True, null = True) . Then if other categories are selected undefined is automatically

Mod_WSGI and lib python

2010-05-06 Thread When ideas fail
Hi, I have been trying to setup mod_wsgi with apache 2 but when I do: sudo a2enmod mod-wsgi sudo /etc/init.d/apache2 restart I get this error message: Restarting web server: apache2apache2: Syntax error on line 185 of / etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-

Extending admin views?

2010-04-20 Thread When ideas fail
If i have an admin form and want to transform some data to another format using AJAX within the form, what is the best way to do this. In a normal form I can do this within the view but is there any way to extend admin views to add new functionality without loosing the default admin view

Extending admin views?

2010-04-20 Thread When ideas fail
If i have an admin form and want to transform some data to another format using AJAX within the form, what is the best way to do this. In a normal form I can do this within the view but is there any way to extend admin views to add new functionality without loosing the default admin view

queryset in clean method

2010-04-06 Thread When ideas fail
hello, i have a clean method in my forms.py. I want this to check a person is old enough to enter a competiton The problem i have is that the minimum age changes and is a field in the competition model(it is entered by the user). My clean method is like this (pseudo code): class

Re: Resize image if too large

2010-03-15 Thread When ideas fail
our code > > but in our case the form class should do the validation... > > On Mar 15, 5:07 pm, When ideas fail <andrewkenyon...@gmail.com> wrote: > > > Hello, I've been trying to create a save method which resizes an image > > if it is too large. Using p

Resize image if too large

2010-03-15 Thread When ideas fail
Hello, I've been trying to create a save method which resizes an image if it is too large. Using pil this is what I have so far: class Photo(models.Model): title = models.CharField(max_length=750) photo = models.FileField(upload_to='full_size/') alt = models.CharField(max_length=50,

Re: Toggle TinyMCE in admin

2010-02-22 Thread When ideas fail
Would that just do one field rather than all the text areas? On 22 Feb, 16:41, orokusaki wrote: > I think you can do this by adding the exact HTML that you need into > the label field for a form (I can't remember if you have to explicitly > turn off HTML filtering

Re: Toggle TinyMCE in admin

2010-02-22 Thread When ideas fail
Oh I should mention I have already added the javascript function to the page by including the JS file. So I really only need to include the link next to textareas. On 22 Feb, 16:34, When ideas fail <andrewkenyon...@gmail.com> wrote: > Hello, I've been using TinyMCE for a WYSIWYG edi

Toggle TinyMCE in admin

2010-02-22 Thread When ideas fail
Hello, I've been using TinyMCE for a WYSIWYG editor on my admin text areas. However I would like to be able to toggle it on and off like this: http://tinymce.moxiecode.com/examples/example_01.php But I wasn't sure of the best way to do this. Does anyone have any suggestions? Andrew -- You

Re: Admin Javascript

2010-02-16 Thread When ideas fail
Thanks, got it working using that method after abit of messing. On 16 Feb, 14:01, Xavier Ordoquy wrote: > Hi, > > > Hi, I've been trying to use TinyMCE in my admin pages, I've followed > > this tutorial but so far have had no luck. > >

Re: Admin Javascript

2010-02-16 Thread When ideas fail
I got it working after abit of messing using the newforms-admin section instructions: http://code.djangoproject.com/wiki/AddWYSIWYGEditor#Withnewforms-admin I didn't look at django-tinymce. Thanks, Andrew -- You received this message because you are subscribed to the Google Groups "Django

Admin Javascript

2010-02-16 Thread When ideas fail
Hi, I've been trying to use TinyMCE in my admin pages, I've followed this tutorial but so far have had no luck. http://code.djangoproject.com/wiki/AddWYSIWYGEditor I tried using this method (http://beshrkayali.com/posts/4/) , that incoporates the Javascript directly into the templates and that

Re: URL Matching: 404 Error

2010-01-30 Thread When ideas fail
Ah, I see, the problem is with the keys.., not the URLs On 30 Jan, 22:16, When ideas fail <andrewkenyon...@gmail.com> wrote: > Hi, I seem to be having a problem matching one of my URLs. > I have this URL in my .py file in one of my user app. > >  url

URL Matching: 404 Error

2010-01-30 Thread When ideas fail
Hi, I seem to be having a problem matching one of my URLs. I have this URL in my .py file in one of my user app. url(r'^activate/(?P\w+)/$', activate, name='registration_activate'), and then thats added to my project urls: (r'^users/',

Re: Imports, works from directory but not from file

2009-11-10 Thread When ideas fail
<ke1g...@gmail.com> wrote: > Which all of these directories are on your python path, and which of > them have __init__.py files? > > Bill > > [Hint to answer first question: > > from pprint import pprint as pp > import sys > pp(sys.path) > > ] > >

Imports, works from directory but not from file

2009-11-10 Thread When ideas fail
I have a folder called lib on my path and in there I have a folder called openid. If i want to import things from openid i have a problem. For example if I have these 2 import statements: from openid.yadis import xri from openid.association import Association as OIDAssociation yadis is a

Re: Middleware stored locally

2009-10-15 Thread When ideas fail
I have an init.py, is the path the likely problem or is it something else? thanks, Andrew On 15 Oct, 02:07, BenW <benwil...@gmail.com> wrote: > I think every dir on the import path needs and __init__.py > > On Oct 14, 5:10 pm, When ideas fail <andrewkenyon...@gmail.com> w

Middleware stored locally

2009-10-14 Thread When ideas fail
If i have a lib folder in my app what is the correct way to reference it in settings.py? I've tried this MIDDLEWARE_CLASSES = ( 'myapp.lib.django_authopenid.middleware.OpenIDMiddleware' # and 'myapp.django_authopenid.middleware.OpenIDMiddleware' ) the file its in is

Extending Django's Flatpages

2009-10-02 Thread When ideas fail
Hello, i've been having a look at this post on overmortal about Extending Django's Flatpages: http://www.overmortal.com/blog/post/17-extending-django-s-flatpages specifically this section " Finally, in order to continue using the flatpages/default.html template file as the singular file for

Named URL Patterns -- Syntax Error

2009-09-25 Thread When ideas fail
Can somebody tell me why i get a syntax error with this named URL pattern? urlpatterns = patterns('', url(r'^feed/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds} name="feed"), ) This is the traceback: Traceback: File

URL Tag for feeds

2009-09-24 Thread When ideas fail
If i want to create a URL tag for feeds then where should the path.to.view point to? Should it point to urls.py or feeds.py? or do i need to do something else entirely? This is using the standard sydication framwork. Thanks, Andrew --~--~-~--~~~---~--~~ You

URL Tag

2009-09-24 Thread When ideas fail
Hello, I was wondering if somebody could tell me what i'm doing wrong. I keep getting this error relating to a url tag: Traceback: File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response 92. response = callback(request, *callback_args,

mod_python to mod_wsgi

2009-09-20 Thread When ideas fail
Hello, I've recently updated my setup to use mod_wsgi instead of mod_python. I'm having some problems with my urls. The home page loads fine but none of my other urls seems to work (404 errors). They worked before with mod_python. Do i need to include something else in my .wsgi file? import os

MySQL

2009-09-19 Thread When ideas fail
Hello, when I run python manage.py syncdb I get this error: File "C:\\Python26\lib\site-packages\MySQLdb\connections.py", lin e 170, in __init__ super(Connection, self).__init__(*args, **kwargs2) _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'lo calhost'

Re: html Escape

2009-08-25 Thread When ideas fail
tml import strip_tags > > In your view > comment = strip_tags(request.POST["comment"]) > > -- > Regards > Parag > > On Tue, Aug 25, 2009 at 4:25 AM, When ideas fail > <andrewkenyon...@gmail.com>wrote: > > > > > Hello, i want to allow user

html Escape

2009-08-24 Thread When ideas fail
Hello, i want to allow users to post comments and I don't want them to be allowed to put html in comments. However I would like the to be able to use paragraph p tags and tags but not anything other. Could someone tell me how to do this? Thanks Andrew

Re: Image Location

2009-08-23 Thread When ideas fail
Seems to be working now. Thanks. On 23 Aug, 18:28, When ideas fail <andrewkenyon...@gmail.com> wrote: > I changed it to post_img.url but i assume thats a different way of > doing the same thing. > > 1.The html source gives the image location as "http://www.mys

Re: Image Location

2009-08-23 Thread When ideas fail
SetHandler None allow from all order allow,deny SetHandler None Alias /imgs/ "/home/mysite/content/imgs/" Andrew On 23 Aug, 17:18, "J. Cliff Dyer" <j...@sdf.lonestar.org> wrote: > On Sun, 2009-08-23 at 06:54 -0700, When ideas fail wrote: > > Hello, i'm ha

Re: Image Location

2009-08-23 Thread When ideas fail
SetHandler None allow from all order allow,deny SetHandler None Alias /imgs/ "/home/mysite/content/imgs/" Andrew On 23 Aug, 17:18, "J. Cliff Dyer" <j...@sdf.lonestar.org> wrote: > On Sun, 2009-08-23 at 06:54 -0700, When ideas fail wrote: > > Hello, i'm ha

Image Location

2009-08-23 Thread When ideas fail
Hello, i'm having a problem getting images to display so I was wondering if someone would be kind enough to help? I have my settings.py set up as follows (content is the folder where my static images are stored): MEDIA_ROOT = '/home/mysite/content/' MEDIA_URL = 'http://www.mysites.net/content/'

Admin templates

2009-08-21 Thread When ideas fail
Hello, i'm having some problems getting the admin templates up and running. If i have my admin templates at '/home/mysite/media/admin/' what should my ADMIN_MEDIA_PREFIX be? and is that all i need to specify where the templates are? Also do i need to set up a directive along the lines of:

Re: if forloop.counter

2009-08-13 Thread When ideas fail
Thanks! On 13 Aug, 20:52, Jonas Obrist <ojiido...@gmail.com> wrote: > When ideas fail wrote: > > Hello, i know you can have things like {% if forloop.last %} > > but is it possible to have an if statement that matches the value of a > > forloop coun

if forloop.counter

2009-08-13 Thread When ideas fail
Hello, i know you can have things like {% if forloop.last %} but is it possible to have an if statement that matches the value of a forloop counter so it would be like: {% if forloop.counter = 6 % } or similar and how could i do that? Thanks

Re: Filter based on dates

2009-08-12 Thread When ideas fail
Thanks, i'd just worked that out, was about to come and post it. Thanks though. On 12 Aug, 20:23, Dj Gilcrease <digitalx...@gmail.com> wrote: > On Wed, Aug 12, 2009 at 12:02 PM, When ideas > > fail<andrewkenyon...@gmail.com> wrote: > > def months_archive(request, year

Filter based on dates

2009-08-12 Thread When ideas fail
Hello, if i have this view: def months_archive(request, year, month): blog_posts = Post.objects.all().order_by("-post_date") ... how can i filter the post objects by date? I have a field post_date which is a datetime field, and i need it to return all the posts written

Re: Post matching query does not exist.

2009-08-11 Thread When ideas fail
After some more experiments i've decided its definetly some sort of problem with the URLs, if i comment one out the 2nd works and if i have them uncomment it doesn't. Can anyone help me with this please? On 11 Aug, 19:30, When ideas fail <andrewkenyon...@gmail.com> wrote: > Hi, I have

Post matching query does not exist.

2009-08-11 Thread When ideas fail
Hi, I have a strange error which i hope someone might be able to help me with. Two of my urls seems to be conflicting somehow. i have these two URLs: (r'^blog/(?P.+)/$', 'mysite.blog.views.title_view'), (r'^blog/category/(?P.+)/$', 'mysite.blog.views.category_view'),

Question about URLs

2009-08-10 Thread When ideas fail
If i have a URL such as: (r'^(?P\w+)/blog/', include('foo.urls.blog')), what are the whats the purpose of the w and the +? i'm having some problems with 2 of my urls and i think it may have something to do with this. Thanks --~--~-~--~~~---~--~~ You received

Re: Contact form

2009-08-10 Thread When ideas fail
Ok thanks, i'll have a look at the setup then. On 10 Aug, 20:29, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Aug 10, 8:23 pm, When ideas fail <andrewkenyon...@gmail.com> wrote: > > > > > Hi, i've created a contact fom based on the one in the docs bu

Contact form

2009-08-10 Thread When ideas fail
Hi, i've created a contact fom based on the one in the docs but i don't know what to put as the action in the form element as part of template. I've got this template: {{ form.as_p }} but presuambly the data is being handled by the view. I'd appreciate any help, i tried it without an action

2 Questions about feeds

2009-08-08 Thread When ideas fail
Hi, i'm developing a feed but i still have a couple of questionss. 1. I have this in my models: def get_absolute_url(self): return "/blog/%s/" % self.post_slug but the rss has the links down as: http://example.com/blog/post_3/, the blog/post_3/ is correct, how can i make sure its

Feed arguments

2009-08-07 Thread When ideas fail
Hello, i've trying to do an rss feed. I've had alook at the docs and i have the feeds set as: feeds = { 'latest': LatestEntries, 'categories': LatestEntriesByCategory, } but it doesn't say much about LatestEntriesByCategory, is this if i have multiple catergories? Is it possible to

Counting results

2009-08-05 Thread When ideas fail
Hi, I was wondering what is the simpliest way to count the number of objects returned in a QuerySet? Basically i have a blog and i want to count the number of comment relating to each post and display it, the blog posts are shown on a seperate page to the comments but i guess you would still

Re: Printing a cetain number of characters

2009-08-03 Thread When ideas fail
thank you, i should have looked at filters. On 3 Aug, 23:42, Jonas Obrist <ojiido...@gmail.com> wrote: > use: {{ object.body|slice:":30" }} > > When ideas fail wrote: > > Hi, If i am using something like {{object.body}} is it possible to > > limit the numbe

Printing a cetain number of characters

2009-08-03 Thread When ideas fail
Hi, If i am using something like {{object.body}} is it possible to limit the number of characters being printed out. So say you wanted 30 characters, it would print the 30 and ignore the rest. Thanks, Andrew --~--~-~--~~~---~--~~ You received this message because

Re: Log in problem

2009-07-31 Thread When ideas fail
;I [may] disapprove of what you say, but I will defend to the death your > right to say it." -- Voltaire > > > > When ideas fail wrote: > > I'm using (r'^login/$', 'django.contrib.auth.views.login', > > {'template_name': 'blogSite/login.html'}), for the view, so does th

Re: Log in problem

2009-07-31 Thread When ideas fail
t; Are you passing the "request" to it? > That's the only thing I can think of that would mess it up, otherwise it > looks good syntactically. > > Luke > > luke.seelenbin...@gmail.com > > "I [may] disapprove of what you say, but I will defend to the death you

Log in problem

2009-07-31 Thread When ideas fail
Hi, i am using this template to log people in, but it seems to always return the login form no matter what i do, i can be logged in or logged out and it will still say i need to log in. Does anyone know what might be happening. Any help would be appreciated. Thanks {% extends

Stopping people loging in twice

2009-07-31 Thread When ideas fail
Hello, if i am using this generic view in my urls.py? (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'myapp/login.html'}), Is there a way i can stopped people who are already logged in logging in again? Thanks --~--~-~--~~~---~--~~

redirecting after login

2009-07-31 Thread When ideas fail
I was wondering if there was a way to redirect users after login to the page they where looking at before they logged in. So if they where on "/blog/" when they logged in they could be redirected back and if they where on "/about_us/" they could be redirected to "/about_us/"? I'd appreciate any

Re: Submitting a form

2009-07-29 Thread When ideas fail
Thank you On 30 July, 00:04, Adam Yee <adamj...@gmail.com> wrote: > Use the model's verbose field > namehttp://docs.djangoproject.com/en/dev/topics/db/models/#id2 > > On Jul 29, 3:55 pm, When ideas fail <andrewkenyon...@gmail.com> wrote: > > > Is there a way i

Re: Submitting a form

2009-07-29 Thread When ideas fail
Is there a way i can change the label for a field in the model form? On 29 July, 21:44, When ideas fail <andrewkenyon...@gmail.com> wrote: > Ok thanks seems to work now. > > On 29 July, 21:27, Daniel Roseman <dan...@roseman.org.uk> wrote: > > > On Jul 29, 9:17 pm,

Re: Submitting a form

2009-07-29 Thread When ideas fail
Is there a way i can change the label for a field in the model form? On 29 July, 21:44, When ideas fail <andrewkenyon...@gmail.com> wrote: > Ok thanks seems to work now. > > On 29 July, 21:27, Daniel Roseman <dan...@roseman.org.uk> wrote: > > > On Jul 29, 9:17 pm,

Re: Submitting a form

2009-07-29 Thread When ideas fail
Ok thanks seems to work now. On 29 July, 21:27, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Jul 29, 9:17 pm, When ideas fail <andrewkenyon...@gmail.com> wrote: > > > > > I've created a model form and I was wondering what the correct way to > > save th

Submitting a form

2009-07-29 Thread When ideas fail
I've created a model form and I was wondering what the correct way to save this was. I've tried adapting the view from the standard django forms docs but maybe it should be different? This is what i have in my view (it says contact form but its a form that should save contacts in a db): class