Fwd: Re: TransactionMiddleware and SessionMiddleware

2008-12-10 Thread Tim Sawyer
On Wednesday 10 December 2008 16:46:36 Thomas Guettler wrote: > Hi, > > I follow: http://docs.djangoproject.com/en/dev/topics/db/transactions/ > {{{ > The order is quite important. The transaction middleware applies not > only to view functions, but also for all middleware modules that come > afte

Re: Setting the time on a datetimefield

2008-07-15 Thread Tim Sawyer
On Monday 14 Jul 2008, Rajesh Dhawan wrote: > On Jul 14, 5:40 pm, Tim Sawyer <[EMAIL PROTECTED]> wrote: > > On Monday 14 Jul 2008, Rajesh Dhawan wrote: > > > The replace method here returns a new instance of a datetime object -- > > > it's not

Re: Setting the time on a datetimefield

2008-07-15 Thread Tim Sawyer
On Tuesday 15 Jul 2008, Arien wrote: > On Tue, Jul 15, 2008 at 4:57 AM, Tim Sawyer <[EMAIL PROTECTED]> wrote: > > In my code, I did this: > > > > self.datetime = pForm.cleaned_data['datetime'] > > > > the datetime parameter passed from the for

Defaulting Site in NewFormsAdmin

2008-07-25 Thread Tim Sawyer
Hi Folks, I'm trying to build a web app that has many sites, all of which share the same code and database. I'm therefore using the Sites framework, but I need to hide the site that is being edited in the admin. I have done this where my model has a Foreign Key of site, mainly by defining th

Changing Login Page for Admin

2008-08-24 Thread Tim Sawyer
Hi, I'm using the newforms admin stuff, and I'd like to use my own URL for the login page for the admin site. So, if someone goes to /admin on my site (which is where the admin site is located), I'd like to redirect to /private/login/?next=/admin. (The reason I want to do that is that I have

Re: Changing Login Page for Admin

2008-08-25 Thread Tim Sawyer
On Sunday 24 Aug 2008, Tim Sawyer wrote: > Hi, > > I'm using the newforms admin stuff, and I'd like to use my own URL for the > login page for the admin site. > > So, if someone goes to /admin on my site (which is where the admin site is > located), I'd like

sorl thumbnail

2008-09-05 Thread Tim Sawyer
Has anyone got sorl thumbnail working with the latest svn code? I'm just getting src="" using src="{% thumbnail image.image 200x100 %}" Cheers, Tim. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Re: sorl thumbnail

2008-09-05 Thread Tim Sawyer
ings.py > > On Sep 5, 4:30 pm, Tim Sawyer <[EMAIL PROTECTED]> wrote: > > Has anyone got sorl thumbnail working with the latest svn code? > > > > I'm just getting src="" using src="{% thumbnail image.image 200x100 %}" > > > > Cheers, &

INSTALLED_APPS from a template

2008-09-25 Thread Tim Sawyer
Hi Folks, I'd like to conditionally add a link based on whether a specific app is included in INSTALLED_APPS or not. Is there an easy way to do this from a template? Cheers, Tim. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: INSTALLED_APPS from a template

2008-09-26 Thread Tim Sawyer
That's just what I needed, thanks very much. Tim. On Thursday 25 Sep 2008, Rock wrote: > from django import template > from django.conf import settings > from django.template.defaultfilters import stringfilter > > register = template.Library() > > @register.filter > @stringfilter > def installed

Set referer header in test client?

2008-09-29 Thread Tim Sawyer
Hi, I'm having a problem testing with: c = Client() response = c.post('/guestbook/', { 'name' : 'name', 'email' : 'email', 'realurl' : 'u

Re: Set referer header in test client?

2008-09-30 Thread Tim Sawyer
On Tuesday 30 Sep 2008, Russell Keith-Magee wrote: > > Can I simulate this header with the test client? > > Yes. > > The full method signature for client.post() is: > def post(self, path, data={}, content_type=MULTIPART_CONTENT, **extra): > > 'extra' is an argument that allows you to specify a

Template Tags in Text

2008-10-14 Thread Tim Sawyer
Hi, I'm trying to puzzle out the best way of achieving something, and I'd appreciate some help. My website contains text writeups of events, and a gallery. I'd like to embed some images from the gallery into the text writeups. The text is not in a template, it's in the database and displaye

DateField comparison with date.today()

2009-01-27 Thread Tim Sawyer
Hi, I have a model that includes: from datetime import date as pydate, datetime date = models.DateField() I've overridden delete to do: def delete(self): ... if self.date < pydate.today(): Notification.process(None, self, 'Event deleted') and that works fine If I

Re: DateField comparison with date.today()

2009-01-30 Thread Tim Sawyer
On Wednesday 28 January 2009 04:34:50 Malcolm Tredinnick wrote: > On Tue, 2009-01-27 at 22:03 +0000, Tim Sawyer wrote: > > Hi, > > > > I have a model that includes: > > > > from datetime import date as pydate, datetime > > > > date = models.Dat

Fwd: Re: Class coverage report for automated tests in django apps

2009-02-06 Thread Tim Sawyer
I'm doing that using coverage.py, I based my solution on these blog posts: http://siddhi.blogspot.com/2007/04/code-coverage-for-your-django-code.html http://siddhi.blogspot.com/2007/07/django-code-coverage-followup.html Cheers, Tim. -- Forwarded Message -- Subject: Re: Clas

to_field in model not working

2009-02-11 Thread Tim Sawyer
Hi, We're building an application with django on top of a legacy database and we've hit a problem with a to_field option being ignored. We've reproduced it with the latest svn version of django and a different database (oracle -> sqllite) Our model includes: uas_use_oracle_user = models.Foreig

Re: to_field in model not working

2009-02-12 Thread Tim Sawyer
On Thursday 12 February 2009 01:47:31 Malcolm Tredinnick wrote: > On Wed, 2009-02-11 at 10:45 +0000, Tim Sawyer wrote: > > Hi, > > > > We're building an application with django on top of a legacy database and > > we've hit a problem with a to_field option be

Re: Anyway to render a template without inheritance?

2009-06-22 Thread Tim Sawyer
Yes, just don't do the extends and include all the HTML you need in the template. Tim. > > Hello. > > Is there any way to render a template, omitting the "extends" tag? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

onkeyup event on form field

2009-07-09 Thread Tim Sawyer
Hi, I'd like to add an onkeyup event on a form field. I've defined the following in my form: contest = forms.CharField(max_length=100, widget=forms.TextInput(attrs={"onkeyup" : "lookup(this.value,'id_contest');",} ) ) This comes out

save_formset in admin

2009-05-08 Thread Tim Sawyer
Hi, I'm overriding save_formset in a subclass of ModelAdmin. This worked fine using svn 9382, but I've just updated to svn 10674 and it's not working. def save_formset(self, request, form, formset, change): """ Stamp the model as last changed by the current user Set the

Re: save_formset in admin

2009-05-08 Thread Tim Sawyer
On Friday 08 May 2009 12:39:59 Alex Gaynor wrote: > On Fri, May 8, 2009 at 1:38 PM, Tim Sawyer wrote: > > Hi, > > > > > > I'm overriding save_formset in a subclass of ModelAdmin. This worked fine > > using svn 9382, but I've just updated to svn 10674

Re: ForeignKey Select List Filter

2009-05-08 Thread Tim Sawyer
Will this do? http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to You could always fallback on doing the droplist manually. Tim. On Friday 08 May 2009 14:23:36 cfiles wrote: > Still stuck on this one. Does anybody have any ideas? > > On Apr 29, 8

I/O operation on closed file

2009-05-12 Thread Tim Sawyer
Hi, I'm getting the following error uploading images to my gallery using the admin site, written in django (full stack at bottom of mail) ValueError: I/O operation on closed file It doesn't always happen, and it;s more likely to occur using "Save but keep editing" in the admin. I'm using svn

Re: I/O operation on closed file

2009-05-14 Thread Tim Sawyer
On Tuesday 12 May 2009 21:28:35 Alex Gaynor wrote: > On Tue, May 12, 2009 at 3:27 PM, Tim Sawyer wrote: > > ValueError: I/O operation on closed file > > This is probably a symptom of http://code.djangoproject.com/ticket/11084 . > Thanks Alex. I've just updated to 10784

Oracle and Primary Keys

2009-05-19 Thread Tim Sawyer
Hi, I have a django model that looks like this: class Lender(models.Model): id = models.IntegerField(primary_key=True, db_column='lse_serial') version = models.IntegerField(db_column='lse_version') name = models.CharField(max_length=50, db_column='lse_lender') uri = models.TextFi

Re: Oracle and Primary Keys

2009-05-19 Thread Tim Sawyer
On Tuesday 19 May 2009 16:20:58 Karen Tracey wrote: > On Tue, May 19, 2009 at 10:51 AM, Tim Sawyer wrote: > > It hasn't created a sequence/trigger for the primary key. Why is this? > > It does work for tables that have an implicit primary key (ie not > > specified

Re: Newbie Django 1.0 help with create object, uopdate object

2009-06-01 Thread Tim Sawyer
On Monday 01 June 2009 01:38:30 adelaide_mike wrote: > I found a really clear explanation of creating and updating database > objects in SAMS TeachYourself Django, but it appears to be for v > 0.96. > > I have looked at "Creating forms from models" in the documentation, > and about one-third the w

Re: Newbie Django 1.0 help with create object, uopdate object

2009-06-01 Thread Tim Sawyer
t; 'message': message}) > > My property_update function is called when the form Save button is > clicked. The various "print" commands operate as expected. However, > the validation fails and a form with no data is returned with > "required data" lab

Re: user.is_authenticated

2009-06-01 Thread Tim Sawyer
You need a RequestContext for the user object to be available in templates http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/ I use a render_auth method instead of render_to_response, which automatically adds the RequestContext to all of my templates. Tim. On Monda

django-reversion with recent svn django

2009-06-02 Thread Tim Sawyer
Hi, I'm using django svn 10784, and I've just added django-reversion, latest svn version from trunk (198). I'm using the middleware option for django- reversion. It's not working, and I'm getting the following error. I've tried with the same django version and the tagged 1.1.1 release of dja

Re: django-reversion with recent svn django

2009-06-02 Thread Tim Sawyer
ears fine. Tim. On Tuesday 02 June 2009 22:01:26 Tim Sawyer wrote: > Hi, > > I'm using django svn 10784, and I've just added django-reversion, latest > svn version from trunk (198). I'm using the middleware option for django- > reversion. > > It's not w

Redirects on HTTPS

2009-10-22 Thread Tim Sawyer
Hi, I have a django app that works fine using http. We have a requirement to serve the entire site using https, which is being done at the proxy level - so the Apache that my django is running inside (mod_wsgi) doesn't know about the https. I have a problem with using HttpResponseRedirect - the

Redirects on HTTPS

2009-10-26 Thread Tim Sawyer
I still can't get this to work (original thread at http://groups.google.com/group/django-users/browse_thread/thread/cdece5ef2e7fd280). I'm looking to get a HttpResponseRedirect in my django app to redirect to HTTPS not HTTP. I've tried: * proxy server Apache (the one doing the SSL) does: SetEnv

Re: Django with GXmlHttp

2009-11-25 Thread Tim Sawyer
Not quite sure what you're looking for, but I've used google maps with django, without using GeoDjango. http://www.brassbandresults.co.uk/map/ The script used in this page is here: http://www.brassbandresults.co.uk/map/map_script.js which is generated using this template: function initializ

Re: how to import a library in only in django project

2009-11-25 Thread Tim Sawyer
Hi Amit, It depends how you're running. If you're using ./manage.py testserver, then change manage.py to add in your new path. If you're using mod-wsgi, then change the site-wsgi.py file: import os, sys sys.path.append('/home/path/to/add') os.environ['DJANGO_SETTINGS_MODULE'] = 'MySite.setting

Feeds from the Tag Framework

2009-12-19 Thread Tim Sawyer
Hi Folks, The complex example of an Atom feed (http://docs.djangoproject.com/en/1.1/ref/contrib/syndication/#a-complex-example) is based on a model where it's possible to work out from a single element in the feed (in this case a Crime), what the driving object is (a Beat). So there's a many

Oracle cursor.execute problem

2010-04-23 Thread Tim Sawyer
Hello. This code works fine: >>> import cx_Oracle >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), lDatabaseName) >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, lDatabasePassword, lDsn) >>> lConnection = cx_Oracle.connect(lConnectString) >>> cursor = lConnection.cursor

Re: Oracle cursor.execute problem

2010-04-25 Thread Tim Sawyer
Ian wrote: On Apr 23, 1:59 pm, Tim Sawyer wrote: Hello. This code works fine: >>> import cx_Oracle >>> lDsn = cx_Oracle.makedsn(lDatabaseHost, int(lDatabasePort), lDatabaseName) >>> lConnectString = "%s/%...@%s" % (lDatabaseUsername, lDat

Re: Oracle cursor.execute problem

2010-04-27 Thread Tim Sawyer
Ian wrote: On Apr 25, 11:13 am, Tim Sawyer wrote: >>> import cx_Oracle >>> from django.db import connection >>> cursor = connection.cursor() >>> lOutput = cursor.var(cx_Oracle.STRING) >>> cursor.execute("BEGIN %s := 'N';

Re: Oracle cursor.execute problem

2010-04-29 Thread Tim Sawyer
Excellent, I'll give trunk a go. Thanks Ian. Tim. Ian wrote: On Apr 27, 2:36 pm, Tim Sawyer wrote: Hmm, nearly. That gets around the error, but the return value isn't populated. >>> import cx_Oracle >>> from django.db import connection >>> curs

subprocess.Popen breaks dev server

2010-06-18 Thread Tim Sawyer
Hi Folks, I have code that does this: lCommand = ["hg","history", "-r", "%s:%s" % (pFrom, pTo)] lProcess = subprocess.Popen(lCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE) in a view. When using the dev server, I'm quite often getting a blank page instead of my HTML, and for each pa

Re: No module named site - error deploying a django-jython war in tomcat

2010-07-16 Thread Tim Sawyer
I got around this problem by downgrading from jython 2.5.2beta1 to jython 2.5.1. Hope that helps! Tim. On 15/07/10 22:47, Jose Flores wrote: Hi guys, Any workaround on this issue? Regards, Jose On Jul 8, 2:43 pm, Rafael Nunes wrote: Same problem here. Any thoughts? On Jun 29, 10:50 am,

Re: URL problem

2010-07-19 Thread Tim Sawyer
I think the problem is your regular expression: ^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P\w+)/$ This says - four digits for a year (2010 - ok) - slash - three letters from a-z for month (jul - ok) - slash - one or two letters for day (11 - not ok, this should be \d{1,2}) - slash - slug, made up of

Re: Search Field on All Pages

2010-08-08 Thread Tim Sawyer
What I do is to setup a search that works at /search/q=search_term, and then create a form on each page that submits to /search. This form is in my top level site template. The /search/ url is part of a search application. There's an example of this working at http://www.brassbandresult

Re: Search Field on All Pages

2010-08-08 Thread Tim Sawyer
On 08/08/10 14:48, kostia wrote: To continue, Tim, do you use haystack? I passed its beginning tutorial and configured with xapian through haystack-xapian module. Now I'm discovering the other haystack docs and api. Not everything is clear. For example I have a user with name Bob. When I type in

Re: accessing a dictionary in template

2010-08-09 Thread Tim Sawyer
On 09/08/10 19:56, owidjaya wrote: in php i can do this $some_mapping = array( "var1" : content_var1, "var2" : content_var2, ) for($i =1; $i< 3; $i++){ echo $some_mapping["var"+$i]; } can i do this in django template

Re: javascript

2010-08-13 Thread Tim Sawyer
Yes myJavaScriptFunction( {{DjangoTemplateVariable}} ); function myJavaScriptFunction( pValue ) { ... } Tim. > Hi > Is it possible to give a javascript function a django variable as a > parameter? > thank you > > -- > You received this message because you are subscribed to the Google Groups >

Re: Bind variables in Oracle backend - how to use them?

2010-08-18 Thread Tim Sawyer
Friends, I'm in need of an implementation which calls for using bind variables (in Oracle sense, not generic) in my SQL in a Django application. Any experience with that, anyone? Here's an example using bind variables to return output values from a PL/SQL block. >>> import cx_Oracle >>> f

Re: Bind variables in Oracle backend - how to use them?

2010-08-19 Thread Tim Sawyer
gant. However, both "my" and yours solution suffer from the same defect imho -- that the ORM machinery of Django is unusable. We are back to manual mapping of rows onto objects... Or -- am I mistaken? Tim Sawyer-6 wrote: Friends, I'm in need of an implementation which calls for usin

Re: Bind variables in Oracle backend - how to use them?

2010-08-20 Thread Tim Sawyer
Excellent, thanks Ian. It works a treat, post updated. Tim. > On Aug 19, 11:58 am, Tim Sawyer wrote: >> No, I don't think you're mistaken, especially if you want to use hints. >> >> I tried this code again today with the django database connection (using &g

Re: command python not recognized with syncdb

2010-08-25 Thread Tim Sawyer
Add your python directory to your PATH Control Panel/System/Advanced/Environment Variables You'll need to restart your DOS box to pick up the new PATH. Type SET in the DOS box to see the values. Tim. On 25/08/10 09:21, yotta wrote: Hi i am new on Djagon and i was fellowing the tutorial (pa

Re: writing HTML Code into Template with render_to_response: How?

2010-08-25 Thread Tim Sawyer
On 25/08/10 13:36, mdolphin wrote: OK, that's probably a Newbee Question: My Code generates an HTML-Table, that I want to show up inside a {% block %} in my Template. All I get is an encoded output of my generated HTML-Sourcecode inside the Template. so i.e becomes and so on. How could I a

Re: SITE_ID

2010-09-25 Thread Tim Sawyer
On 25/09/10 15:57, craphunter wrote: Yes, I have read it, but I don't really get it. What is the meaning of it? Consider a website that has multiple blogs, all of which are deployed to the same database. Consider that you want each blog to be a separate URL: www.blog1.com, www.blog2.com, bu

Re: Django on Apache

2010-09-25 Thread Tim Sawyer
On 25/09/10 16:07, Derek wrote: I am about a week into learning Django, having developed with PHP and the CodeIgniter framework for the past 3 years. That said, I'm used to making a change to a file, refreshing my browser and seeing the results. Django's "syncdb" aside, it's been pretty weird h

Re: Django on Apache

2010-09-25 Thread Tim Sawyer
On 25/09/10 19:36, Derek wrote: on several occasions I've made changes to a view, and got a "cannot load page/no response" (from the browser, not a Django error). Once I quit the server (Control-C), start it up again and refresh the page, it works fine. I get that sometimes too - I think it's

Re: error in urlconf

2010-09-25 Thread Tim Sawyer
On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: error in urlconf

2010-09-25 Thread Tim Sawyer
On 25/09/10 21:14, bagheera wrote: Dnia 25-09-2010 o 22:04:16 Tim Sawyer napisał(a): On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. use raw definitions like d

Re: SITE_ID

2010-09-27 Thread Tim Sawyer
> On 25/09/2010 18:32, Tim Sawyer wrote: >> On 25/09/10 15:57, craphunter wrote: >>> Yes, I have read it, but I don't really get it. What is the meaning of >>> it? >> >> Consider a website that has multiple blogs, all of which are deployed to >> th

Re: Removing the 'site' (not the website/url) field from django-comments

2010-09-28 Thread Tim Sawyer
> Hi all, > > I'm trying to have comments on my sites shown on all other sites, as I > have a 'mobile' skin for my site on a separate domain and site_id. > > So for example: > Joe posts a comment on http://www.site1.mydomain.com > > Mary goes to http://www.mobilesite.mydomain.com and can see and >

Re: Adding help text to Django admin

2010-10-04 Thread Tim Sawyer
Set help_text on the appropriate model field name = models.CharField(max_length=100, help_text='Current name of band') Tim. On 04/10/10 09:46, Sithembewena Lloyd Dube wrote: Greetings folks, I need to add "help text" to a Django admin. Sort of like the text below fields in the Django Redirect

Re: apache reload

2010-10-04 Thread Tim Sawyer
On Oct 3, 5:39 pm, Олег Корсак wrote: Hello. I'm using mod_wsgi 3.3 + apache 2.2.16 on Gentoo Linux box. Is it possible to make apache kinda "reload"/"re-read"/"re-compile" python files from my django code every time they are changed? Yes. You get get mod_wsgi to watch your source files and r

Re: django graphs

2010-10-06 Thread Tim Sawyer
I've used http://teethgrinder.co.uk/open-flash-chart-2/ and http://g.raphaeljs.com/ To do charts in a Django app. Tim. > ashy wrote: >> Hi All, >> >> I want to create line graph in django. I have installed django graphs, >> but there aren't sufficient examples for line graphs in the examples

Re: Django and Flux

2010-10-18 Thread Tim Sawyer
> You cant combine Django and Flex Builder - but you can write apps using > Django and Flex. With Flex 3 (and maybe 4, I don't know) you could install it as an Eclipse Plugin, instead of standalone. You could then install pydev into Eclipse as well, and edit both sides of the app in the same Ecli

Postgres LATIN1 to UTF-8

2010-11-07 Thread Tim Sawyer
Hi Folks, Does anyone have a recommended method for converting a Postgres database from LATIN1 to UTF-8? Am I best sticking to postgres tools or will dumpdata help? I already have accents in my LATIN1 data, and postgres doesn't like importing these back into a database with encoding utf8.

Re: Postgres LATIN1 to UTF-8

2010-11-12 Thread Tim Sawyer
On 08/11/10 07:03, Christophe Pettus wrote: On Nov 7, 2010, at 2:17 PM, Tim Sawyer wrote: Does anyone have a recommended method for converting a Postgres database from LATIN1 to UTF-8? Probably the most efficient way is to use pg_dump with the --encoding option: Dump the database in UTF8

Re: Mobile website using Django

2010-11-18 Thread Tim Sawyer
If it helps, I've used iui and now jquery mobile with Django. http://code.google.com/p/iui/ http://jquerymobile.com/ Some random scribblings of mine on jQueryMobile here: http://drumcoder.co.uk/blog/2010/nov/12/jquery-mobile-basics/ Tim. On 18/11/10 20:51, Helge wrote: Hi I wish to develop

ORA-01425

2010-12-02 Thread Tim Sawyer
Hello, I'm using Django against an Oracle 10 database. It used to work. Then they upgraded it to 10.2.0.5 (not sure what from, I can probably find out). This query now gives: ORA-01425: escape character must be character string of length 1. 'SELECT "BROKER_LENDER_LOG"."BLL_SECURITY_TOKEN"

Re: ORA-01425

2010-12-02 Thread Tim Sawyer
go/db/backends/oracle/base.py?rev=12293 that regressed back to LIKE. http://code.djangoproject.com/ticket/11017 the reason. Tim. On 02/12/10 15:13, Tim Sawyer wrote: Hello, I'm using Django against an Oracle 10 database. It used to work. Then they upgraded it to 10.2.0.5 (not sure what f

Re: ORA-01425

2010-12-02 Thread Tim Sawyer
On 02/12/10 15:40, Jirka Vejrazka wrote: I'm using Django against an Oracle 10 database. It used to work. Then they upgraded it to 10.2.0.5 (not sure what from, I can probably find out). Hi Tim, sorry, I don't have a solution for you, but you might want to check out http://code.djangoproj

Re: ORA-01425

2010-12-02 Thread Tim Sawyer
On 02/12/10 19:14, Jirka Vejrazka wrote: It looks as though something like that may be necessary. For those of you running into this problem, do you get the error with the following query? cursor.execute(r"SELECT 1 FROM DUAL WHERE TRANSLATE('A' USING NCHAR_CS) LIKE TRANSLATE('A' USING NCHAR_C

Initial Create Table Script

2010-12-03 Thread Tim Sawyer
Is there a way to generate a sql script that gets the entire table structure required for a django project? Including contrib.auth etc. ./manage.py sql django.contrib.auth is giving me: Error: App with label django.contrib.auth could not be found. Are you sure your INSTALLED_APPS setting is c

Re: Initial Create Table Script

2010-12-03 Thread Tim Sawyer
* instead of *./manage.py sql django.contrib.auth* Regards, Anurag On Fri, Dec 3, 2010 at 5:48 PM, Tim Sawyer mailto:list.dja...@calidris.co.uk>> wrote: Is there a way to generate a sql script that gets the entire table structure required for a django project? Including contrib.au

Re: ORA-01425

2010-12-03 Thread Tim Sawyer
On 03/12/10 12:52, Jani Tiainen wrote: On Thursday 02 December 2010 17:13:48 Tim Sawyer wrote: Hello, I'm using Django against an Oracle 10 database. It used to work. Then they upgraded it to 10.2.0.5 (not sure what from, I can probably find out). This query now gives: ORA-01425: e

Re: ORA-01425

2010-12-04 Thread Tim Sawyer
On 03/12/10 17:29, Ian wrote: On Dec 2, 3:17 pm, Tim Sawyer wrote: I unpatched mine (changed LIKEC to LIKE) and then ran: >>> from django.db import connection >>> cursor = connection.cursor() >>> result = cursor.execute(r"SELECT 1 FROM DUAL WHERE TR

Re: Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.

2010-12-11 Thread Tim Sawyer
Here's the config I'm using for mod_wsgi: http://drumcoder.co.uk/blog/2009/nov/21/apache-mod_wsgi-config/ Hope that helps, Tim. On 11/12/10 23:35, jc wrote: You definitely lost me in some places but you've also cleared some things up in the process. I also noticed that I had "", which is lack

Optimistic Locking

2008-01-24 Thread Tim Sawyer
Hi Folks, I'm just evaluating django for use on a project. I have a multiuser application where many users can be changing data at once. What's the status of hibernate style optimistic locking, where each object has a version and update/deletes are prevented if the last saved version of that

Newbie Question

2008-01-29 Thread Tim Sawyer
My model includes: surname = models.CharField(maxlength=50) forenames = models.CharField(maxlength=50) def __str__(self): return self.name def name(self): return self.forenames + ' ' + self.surname Referencing name in a template works fine, but in the adm

Re: Newbie Question

2008-01-29 Thread Tim Sawyer
On Tuesday 29 Jan 2008, Tim Chase wrote: > your __str__ returns a function...you omitted the call to that > function: > > def __str__(self): > return self.name() Ah - knew it would be obvious. Thanks. Simple typo on my part, I've just split the name field in two, so it used to be a prope

Re: Newbie Question

2008-01-30 Thread Tim Sawyer
Thanks everyone, I've been reading my Python In a Nutshell ("covers python 2.2!") and it's reminded me of what I've forgotten! Any suggestions for good books? Was going to get the django book and the O'Reilly Python Cookbook. On Tuesday 29 Jan 2008, Ivan Illarionov wrote: > or, better: >d

Re: Optimistic Locking

2008-02-04 Thread Tim Sawyer
On Sunday 03 Feb 2008, code_berzerker wrote: > How about rewriting save method complately and make additional > condition in WHERE clausule like this: > UPDATE ... WHERE id=666 AND mtime=object_mtime > Checking number of updated rows would give you information about > success and would guarant

Re: Optimistic Locking

2008-02-05 Thread Tim Sawyer
On Monday 04 Feb 2008, Michael Hipp wrote: > Tim Sawyer wrote: > > If you're going to do that, then couldn't we change the framework to add > > a new VersionField. If there is a VersionField defined on the object, > > then the code on save could automatical

Deploying django framework with site

2008-02-08 Thread Tim Sawyer
Folks, Has anyone got any documentation on deploying the django framework as part of the site? I'm considering using django for an app at work (on Oracle - so need SVN version?) and our release team will want a self contained site to deploy. They're used to WAR files and like them. It'll be

Problems selecting correct object in view

2008-02-16 Thread Tim Sawyer
Hi Folks, I'm sure I'm missing something here, can anyone enlighten me? In my urls.py I have: (r'^(\d+)/$', 'rtb2.contests.views.single_contest'), and in my views.py I have def single_contest(request, pSerial): lContest = Contest.objects.filter(pk=pSerial) return render_to_respons

Re: Problems selecting correct object in view

2008-02-16 Thread Tim Sawyer
On Saturday 16 Feb 2008, Nils L wrote: > Hi Tim, > Contest.objects.filter(pk=pSerial) yields a list (in this case of > length 1), not a Contest object. If you want to fetch a single object > based on it's primary key you can use: Contest.objects.get(pk=pSerial) > See http://www.djangoproject.com/d

Authentication Question

2008-02-18 Thread Tim Sawyer
Hi Folks, I've read the docs for authentication but I can't see how I can replicate existing functionality I have using php. I have a directory /private on the web server, marked using .htaccess and .htpasswd to only allow access if a username is passed. Anything I put inside this directory

Re: Authentication Question

2008-02-18 Thread Tim Sawyer
On Monday 18 Feb 2008, Rajesh Dhawan wrote: > If you want to make Apache use a Django auth backend, > take a look at: > http://www.djangoproject.com/documentation/apache_auth/ Thanks Rajesh, I think this is exactly what I was fumbling towards! (Excellent analysis of my non-MVC ramblings as we

Assigning Dates to DateField instances

2008-02-21 Thread Tim Sawyer
I'm not sure I understand what I'm doing here. I'm trying to create an Event object from the data in a form (a simple html form, not a django form). I want to do this: lDay = int(request.POST['DayNo']) lMonth = int(request.POST['MonthNo']) lYear = int(request.POST['YearNo']) lE

Using mod in if in template

2008-03-24 Thread Tim Sawyer
Hi Folks, I want to do this: {% for image in Images %} {{ image.name }} {{ image.comment }} {% if forloop.counter % 4 %} {% endif %} {% endfor %} which should hopefully give me a gallery of images where each line has fo

Re: Using mod in if in template

2008-03-24 Thread Tim Sawyer
On Monday 24 Mar 2008, James Bennett wrote: > The first thing to do is to step back and remember that the Django > template language is not Python I know that - writing it as python code was the quickest way to get across what I wanted! :-) > The second thing to do is to read the template docum

Re: Using mod in if in template

2008-03-24 Thread Tim Sawyer
On Monday 24 Mar 2008, Evert Rol wrote: > On 24 Mar 2008, at 19:29 , Tim Sawyer wrote: > >> The second thing to do is to read the template documentation to see > >> what is available, because doing so will turn up things like this: > >> > >> http://www.dj

Re: tutorial __str__() method not working

2008-03-26 Thread Tim Sawyer
Looks like your indentation is wrong (assuming it's not just a copy/paste issue). Remember python code needs to be indented correctly in order to work. Your def __str__(self): line needs to start at the same indentation as the attributes (question/pub_date) inside your class. Tim. On Wednes

mod_python authentication problem

2008-03-28 Thread Tim Sawyer
Hi, I'm trying to secure /site_media/private and /site_media/pictures so that only logged in users can see the files in those directories and below. The error I'm getting (sometimes - seems to be a bit inconsistent) is [Fri Mar 28 09:39:06 2008] [error] [client XXX.XXX.XXX.XXX] PythonAuthenHa

Re: mod_python authentication problem

2008-03-28 Thread Tim Sawyer
> it could work is if the first page hit was a Django application page > which had the side effect of setting os.environ. You probably wouldn't > want to rely on that being the case. > > For alternate mechanism for doing all this see mod_wsgi. > > http://code.google.com/p/mod

Re: mod_python authentication problem

2008-03-28 Thread Tim Sawyer
On Friday 28 Mar 2008, Graham Dumpleton wrote: > On Mar 28, 9:21 pm, Tim Sawyer <[EMAIL PROTECTED]> wrote: > > I've done that and now it's prompting me to login a normal browser dialog > > box. If I use my django login it works - is this expected behaviour

Finding out the index of a model instance in a list

2008-03-29 Thread Tim Sawyer
Hi Folks, If I have an image, and a list of images, how can I work out what position in the list my image is so I can do a Image 4 of 24 type annotation? lImage = GalleryImage.objects.filter(pk=pImageSerial).select_related()[0] lAlbumImages = GalleryImage.objects.filter(album__id = lImage.album

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

2008-03-29 Thread Tim Sawyer
ion < lImagesInAlbum-1: lNextImage = lAlbumImages[lPosition+1] break On Saturday 29 Mar 2008, Tim Sawyer wrote: > Hi Folks, > > If I have an image, and a list of images, how can I work out what position > in the list my image is so I can do a Image 4 of

Serving binary files "through" django

2008-04-05 Thread Tim Sawyer
Hi Folks, I'd like to have a site that gives away and sells PDFs, and tracks downloads of those PDFs. For example, I'd like to know the IP address/useragent of who downloaded the free files, and I'd like to record the same plus the logged in user for the pay ones (after authenticating the us

EmailMessage and BCC fields

2008-04-05 Thread Tim Sawyer
Hi Folks, I've just sent an email using EmailMessage setting the bcc field to be a list of recipients. It sent the email, to the correct recipients, but all my addresses are visible in the mail header, in an email header called bcc. It's not supposed to do that is it, hence the B bit of the

Re: EmailMessage and BCC fields

2008-04-06 Thread Tim Sawyer
On Sunday 06 Apr 2008, Karen Tracey wrote: > Update to a revision with the fix for > http://code.djangoproject.com/ticket/6841, that is r7347 or higher. Fixed, thanks! Tim. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

  1   2   >