Re: Automatically direct unauthenticated users to homepage

2011-11-15 Thread Colin Bean
On Tue, Nov 15, 2011 at 8:25 AM, CrabbyPete wrote: > I have a site with lots of views. When someone comes to my site and is > not logged in I direct them to the homepage to login. However a user > could type in a whole url for a view and it will go there and cause an > error because the view expec

Re: Deleting a model object then returning it

2011-08-15 Thread Colin Bean
On Mon, Aug 15, 2011 at 5:29 PM, Kevin Anthony wrote: > Accoding to the documentation all i need to do is > object = someobject.objects.all().filter(somefield=somevalue) > print object > object.delete() > print object > > and theoretically, object should be unchanged, since according to the > docu

Re: get_object_or_404

2010-11-15 Thread Colin Bean
On Sun, Nov 14, 2010 at 9:23 PM, Akn wrote: > Hi, > I would like to use get_object to retrieve an object form the > database, but if the object does not exist I do not want to display an > error page(404). Is there any command that does that. > > ob=get_object(Table,x=y) > if not ob >     > >

Re: virtualenv used with mod_wsgi

2010-09-14 Thread Colin Bean
Have you tried the steps described here: http://code.google.com/p/modwsgi/wiki/VirtualEnvironments ? Colin On Tue, Sep 14, 2010 at 10:44 PM, Jagdeep Singh Malhi wrote: > I am try to use Multiple version of Django on same machine. > I am using the Virtual Python Environment builder (virtualenv 1.

Re: Database relations concepts

2010-02-19 Thread Colin Bean
On Thu, Feb 18, 2010 at 11:31 PM, Timothy Kinney wrote: > This is a fabulous response, Peter. Thank you very much for making this so > clear. The samurai_set is a revelation for me as well. I see now that I > should look more carefully at the methods available for the models. > > If I can ask anot

Re: Django/GoDaddy

2009-11-15 Thread Colin Bean
On Sun, Nov 15, 2009 at 6:15 AM, mkumm wrote: > I recently took on a new project for a new client where I was forced > into using a GoDaddy Virtual Server (literally it was a deal breaker). > Anyway I have configured about 1/2 dozen servers to run django - but I > am stumped on this. I am looking

Re: SOLVED Is there a way to just submit a simple form? -- Mis-nested tags break things!

2009-10-30 Thread Colin Bean
On Fri, Oct 30, 2009 at 7:00 PM, Mike Ramirez wrote: > On Friday 30 October 2009 18:44:02 sstein...@gmail.com wrote: >> Normally validation is the first thing I check but the w3c validator >> can't validate localhost addresses so I had to use the old "cut & >> past" method to submit my HTML. >> >

Re: Model instance refreshing

2009-08-17 Thread Colin Bean
On Mon, Aug 17, 2009 at 1:31 PM, mettwoch wrote: > > Hi, > > I use a session to store several instances of different models coming > from a: > > some_model.objects.get(pk = some_pk) > > When the data in the db changes the model instances in the session > still contain the old data. What would be a

Re: Views runs twice when using custom context processor

2009-05-22 Thread Colin Bean
On Fri, May 22, 2009 at 7:23 AM, eightflower wrote: > > It appears that {% thumbnail %} tag from sorl-thumbnail app is causing > this. When my context processor is off, > thumbnail just does not have anything to do because it has no context. > > > Are the image tags pointing to the correct path?

Re: HTML works directly in browser, but not in DJango... Why???

2009-05-19 Thread Colin Bean
On Tue, May 19, 2009 at 11:44 AM, Alex Gaynor wrote: > > > On Tue, May 19, 2009 at 1:42 PM, Social Network in DJango > wrote: >> >> I put the below code to embed an mp3 file in an html page in an html >> file and pointed my browser to it.  It works. >> >> I then try >>     url(r'^$','django.view

Re: Limiting the queryset for a foreign key field in the admin change_list view

2009-05-14 Thread Colin Bean
On Thu, May 14, 2009 at 5:26 PM, Margie wrote: > > Sorry for the length of this - I hope someone knowledgable about ajax > has a minute to take a look, I've been working on it for awhile. > George - if you are reading this - this is my attempt to do the jquery/ > ajax that you recommended a few d

Re: disable django cache

2009-05-14 Thread Colin Bean
On Thu, May 14, 2009 at 6:53 PM, online wrote: > > This is my code > > > from django.http import HttpResponse > from django.template import Context, loader > from django.shortcuts import render_to_response > from django.views.decorators.cache import cache_control > @cache_control(no_cache=True) >

Re: Signals giving: global name 'MyModel' is not defined

2009-05-14 Thread Colin Bean
On Thu, May 14, 2009 at 6:48 AM, phoebebright wrote: > > Have been at this now for some hours and still can't see the wood for > the trees.  Failed to get two signals working - one called on pre_save > to keep an audit trail of one field on a model (didn't implemenet the > Audit.py version in the

Re: Template issue

2009-05-07 Thread Colin Bean
On Thu, May 7, 2009 at 2:13 AM, 83nini <83n...@gmail.com> wrote: > > Hi guys, > > I have a template.surf which i'm trying to style with CSS external > file, but it's not working! any idea how to deal with .surf templates? > and how to style them with the CSS external files? > internally working, e

Re: Really really basic,,, use of @ sign in code

2009-05-05 Thread Colin Bean
On Tue, May 5, 2009 at 3:56 PM, dartdog wrote: > > When you're starting out it is often the simplest stuff > I'm reading some code and I see tow blocks with @permalink at the > start, it looks to me that this s just a comment (that requires no > termination i.e. one word??)  but I just wanted

Re: Authenication for django.views.generic Views

2009-04-16 Thread Colin Bean
On Thu, Apr 16, 2009 at 8:25 AM, Col Wilson wrote: > > I'm using generic views to render my pages > (django.views.generic.date_based, django.views.generic.list_detail > etc) and they're very handy. > > However, the app I'm trying to build would like a security and on > reading the "User Authentic

Re: Linking Back to Home Page from Template

2009-04-10 Thread Colin Bean
Take a look at the reverse() function and the "url" template tag: http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url The "url" tag is what you want to generate a link in your template based on one of your URL patterns.

Re: referencing a specific item in a list...

2009-04-09 Thread Colin Bean
On Thu, Apr 9, 2009 at 3:23 PM, Walt wrote: > > After extensive searching, I'm still unable to find a way to reference > individual items in a list without using a for loop. > > For example, I have this basic code in my views.py: > >    project_list = Project.objects.all().order_by('-id')[:6] > >

Re: troubleshooting runserver

2009-03-20 Thread Colin Bean
On Fri, Mar 20, 2009 at 11:28 AM, QUILAD wrote: > > I'm starting my first Django python project.  Running on Linux RH4 > server. > > When I run > manage.py runserver 10.112.112.12:8080 > > I get: > > Validating models... > 0 errors found > > Django version 1.0.2 final, using settings 'repairwf.se

Re: How to process a request with Content-Type: multipart/rfc-822 ?

2009-03-03 Thread Colin Bean
On Tue, Mar 3, 2009 at 2:36 PM, Ville Säävuori wrote: > > I'm playing with an web hook webapp called smtp2web ( http://smtp2web.com > ), which, as it name suggests, forwards email messages to a URL as a > http POST request. > > A quote from docs: "the entire message (including headers) is sent in

Re: Is safe unsafe?

2009-02-23 Thread Colin Bean
On Mon, Feb 23, 2009 at 12:03 PM, Michael Repucci wrote: > > I'm certainly worried about both, but I would like the users to be > able to add JavaScript. Changes to the site will actually have to be > monitored for offensive content (including both JavaScript and > offensive language), so hopeful

Re: WYSIWYG Image upload challenge

2009-02-19 Thread Colin Bean
details for every request that your browser sends in a separate window. Colin > On Feb 18, 8:23 pm, Colin Bean wrote: >> On Wed, Feb 18, 2009 at 10:50 AM, phoebebright >> >> >> >> wrote: >> >> > The javascript makes a call to this view

Re: WYSIWYG Image upload challenge

2009-02-18 Thread Colin Bean
On Wed, Feb 18, 2009 at 10:50 AM, phoebebright wrote: > > The javascript makes a call to this view on submitting the form that > uploads the image. > > def uploadimage(request): >try: >upload_full_path = settings.CONTENT_IMAGES > >upload = request.FILES['im

Re: Django doesn't like serving a view to Apache

2009-01-21 Thread Colin Bean
te: >> >> > It works and outputs what it should:http://dpaste.com/111584/ >> >> > I'll try commenting out some lines and seeing how far it gets. >> >> > On Jan 21, 3:10 pm, Colin Bean wrote: >> >> > > On Wed, Jan 21, 2009 at 11:34 AM, jo

Re: Django doesn't like serving a view to Apache

2009-01-21 Thread Colin Bean
On Wed, Jan 21, 2009 at 11:34 AM, joshuajonah wrote: > > I'm having an issue getting Apache to serve a view. It appears to work > fine through shell (http://dpaste.com/111549/), however when viewed > through a web browser, it loads indefinitely. > > Here is the view: http://dpaste.com/111551/ > >

Re: xml -> django model

2008-12-23 Thread Colin Bean
On Tue, Dec 23, 2008 at 12:11 PM, dick...@gmail.com wrote: > > i'm working on a simple concept i'm sure others have solved, but i > can't get it. > > basically, given some input, i parse it, find which objects to > create, and do it. > > so with a model: > > class Foo(models.Model): > name

Re: time it takes django to read database?

2008-12-09 Thread Colin Bean
On Tue, Dec 9, 2008 at 3:22 PM, garagefan <[EMAIL PROTECTED]> wrote: > > ok, server time is 2 hours and 11 minutes behind... this could explain > the issue then. The admin section, when creating a new entry takes the > time current actual time. So it makes 100% sense that django/python is > readin

Re: time it takes django to read database?

2008-12-09 Thread Colin Bean
On Tue, Dec 9, 2008 at 12:16 PM, garagefan <[EMAIL PROTECTED]> wrote: > > Server is Red Hat 7, set up by godaddy, its a virtual server. Python > 2.5 w/ mod_python and python-devel installed. running latest django. > > I am using webmonkey.com's tutorial for this: > http://www.webmonkey.com/tutoria

Re: time it takes django to read database?

2008-12-09 Thread Colin Bean
On Sun, Dec 7, 2008 at 7:32 PM, garagefan <[EMAIL PROTECTED]> wrote: > > following another tutorial to build a blog (webmonkey.com's) at it was > rather frustrating to see nothing show up after creating a new blog... > > the admin section seems to see these right away, as they are there as > soon

Re: Ruby on Rails vs Django

2008-12-05 Thread Colin Bean
On Fri, Dec 5, 2008 at 4:06 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi All, > > I'm new to the django world and I was just wondering how Django > compears with Ruby on Rails ? > > did anybody try Ruby on Rails so can give us a feedback ? > > thanks > > > > Another big difference be

Re: problem saving form data in sams "24 hour" book example

2008-12-02 Thread Colin Bean
On Tue, Dec 2, 2008 at 5:09 PM, Margie <[EMAIL PROTECTED]> wrote: > > I'm a new user to django and am attempting to go through the Sams > "Teach Yourself Django in 24 hours" book and am having an issue > related to the chapter on saving form data. I'm hoping someone can > give me a hand. > > I'm

Re: Develop in windows, serve in linux

2008-11-25 Thread Colin Bean
On Tue, Nov 25, 2008 at 10:13 AM, Jeff Anderson <[EMAIL PROTECTED]> wrote: > TheIvIaxx wrote: >> This isnt really a django specific question, but i figured some folks >> have a similar setup and might be able to offer advice. I'm >> developing my django site on vista and i have a server running l

Re: localhost host only webservices/authentication in general

2008-11-05 Thread Colin Bean
On Wed, Nov 5, 2008 at 4:24 PM, craic <[EMAIL PROTECTED]> wrote: > > with django, is it possible to restrict the calling host of particular > urls to be the localhost? > > namely, is there a way to restrict say a set of web services > implemented in django to be only accepted if they are the same

Re: Caught an exception while rendering: no such table: django_admin_log

2008-11-04 Thread Colin Bean
On Tue, Nov 4, 2008 at 3:00 PM, joshuajenkins <[EMAIL PROTECTED]> wrote: > > I'm running into an issue when just starting with Django 1.0 where the > following exception is caught: > Caught an exception while rendering: no such table: django_admin_log > > I've done some searching and it appears th

Re: Building Django web application

2008-10-10 Thread Colin Bean
On Fri, Oct 10, 2008 at 12:34 PM, mguthrie <[EMAIL PROTECTED]> wrote: > > I've been looking into Django for building something that is more web > application than it is website. I understand that Django has been > developed in a sort of CMS mindset but to date I haven't found any > reason why it

Re: login problem, Django 1.0

2008-10-09 Thread Colin Bean
On Thu, Oct 9, 2008 at 4:15 PM, Robocop <[EMAIL PROTECTED]> wrote: > > > actually i read that wrong, i do not know what path it is being sent > to. I think that's the root path... you can verify in firefox if you look under preferences > privacy > show cookies. You said you moved from a dev set

Re: login problem, Django 1.0

2008-10-09 Thread Colin Bean
On Thu, Oct 9, 2008 at 3:25 PM, Robocop <[EMAIL PROTECTED]> wrote: > > All right, this is getting absolutely ridiculous. I tried to > workaround my problems by using the built in contrib.auth.views.login, > and of course this resulted in the same behavior. I am very reluctant > to think this is

Re: Strange, one app only appears rarely in the admin interface on apache2 (a reload sometimes works)

2008-09-29 Thread Colin Bean
Sounds like you could have some apache processes holding on to old versions of your code... have you restarted apache recently? Colin On Mon, Sep 29, 2008 at 1:00 PM, rmnl <[EMAIL PROTECTED]> wrote: > > I'm experiencing a strange problem with my project. I have an app > named products and this a

Re: IE Hell. Blank Page

2008-09-18 Thread Colin Bean
On Thu, Sep 18, 2008 at 3:57 PM, lingrlongr <[EMAIL PROTECTED]> wrote: > > Strangest thing... > > I primarily use and develop on Ubuntu and use Firefox. So I went to > check out how many bugs IE was generous enough to give me to fix. > Using the Django development server, I can connect fine from

Re: Take an integer and string and make one string

2008-07-16 Thread Colin Bean
Format strings are your friend: "%s: %d" % (self.consequence, self.slope_height_rr) Colin On Wed, Jul 16, 2008 at 8:14 AM, Molly <[EMAIL PROTECTED]> wrote: > > I am trying to add an integer and a string: > > > def __unicode__

Re: Django, Apache, and CSS

2008-07-08 Thread Colin Bean
The blank page seems suspicious, as usually you'd be getting an error message if something was wrong with your configuration. What do you see if you view the source of that page? Perhaps there's an error in your HTML, like forgetting to close a tag. It's impossible to tell without seeing at th

Re: I'm sure this is one of those clueless newbie mistakes

2008-06-26 Thread Colin Bean
For a start, you want your KVM model to subclass models.Model. Colin On Thu, Jun 26, 2008 at 11:59 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Karen; > > On Jun 26, 12:56 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: >> If you post the contents of your cmdb/models.py file on someplace l

Re: serving root from static

2008-06-10 Thread Colin Bean
On Mon, Jun 9, 2008 at 10:58 PM, Andre Meyer <[EMAIL PROTECTED]> wrote: > thanks a lot, Colin, i will contact the WebFaction guys for the apache > setup. they are always very helpful ;-) > > HOWEVER: for testing purposes only, using only runserver and sqlite, how to > preceed for making this work?

Re: serving root from static

2008-06-09 Thread Colin Bean
On Mon, Jun 9, 2008 at 3:25 PM, Andre Meyer <[EMAIL PROTECTED]> wrote: > thanks Jeff > > yes, i had found this method of having django serve static content, too, and > know it is not ideal. > > what i want is different: use apache for serving the static content at the > root of the site (defind in

Re: why so slow?

2008-06-03 Thread Colin Bean
On Tue, Jun 3, 2008 at 4:01 PM, <[EMAIL PROTECTED]> wrote: > > now i see, ty very much. django seems awesome though now that it is > working for me. > > On 4 Juni, 00:57, "Colin Bean" <[EMAIL PROTECTED]> wrote: >> On Tue, Jun 3, 2008 at 2:00 PM, &l

Re: why so slow?

2008-06-03 Thread Colin Bean
On Tue, Jun 3, 2008 at 2:00 PM, <[EMAIL PROTECTED]> wrote: > > im running part 2 of the tutorial right now and im inside the admin. > when connecting to localhost it is s slow, why? Well, the tutorial does say: "You've started the Django development server, a lightweight Web server written

Re: cut-and-paste traceback error actually the error from the time before --

2008-04-29 Thread Colin Bean
In this situation it might be helpful to use tamper data (or something similar) to examine the all of the requests / responses and see exactly what your server is sending and when Could at least determine if this is broswer behavior or if Django is really sending the incorrect trace. Colin

Re: Has anyone made an MS excel exporter in a django site yet?

2008-04-09 Thread Colin Bean
If your users don't need a binary .xls file, there's an XML-based format for excel. I've rolled my own python code to export data to it, it's pretty easy to do and the excel users didn't seem to notice the difference :) Colin On Wed, Apr 9, 2008 at 3:45 PM, Jeff Anderson <[EMAIL PROTECTED]> wro

Re: Finding out the index of a model instance in a list

2008-03-29 Thread Colin Bean
> > lImage = GalleryImage.objects.filter(pk=pImageSerial).select_related()[0] > lAlbumImages = GalleryImage.objects.filter(album__id = lImage.album.id) > lImagesInAlbum = lAlbumImages.count() > lImagePosition = None > lPreviousImage = None > lNextImage = None > for lPos

Re: usernames and case sensitivity

2008-03-28 Thread Colin Bean
On Fri, Mar 28, 2008 at 10:02 AM, Jonathan Lukens <[EMAIL PROTECTED]> wrote: > > Hi Evert, > > > > > 2) Validate new usernames for case-insensitive uniqueness and filter > > > with case-insensitive queries whenever the username is URL param. > > > > def view(request, username, child=None, ...):