django-ical - iCalendar generation

2012-05-06 Thread Ian Lewis
-ical Code: https://bitbucket.org/IanLewis/django-ical/overview Docs: http://readthedocs.org/docs/django-ics/en/latest/ Thanks, Ian -- Ian http://www.ianlewis.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: What is Django's behavior when a request is interrupted?

2012-05-29 Thread Ian Clelland
server fails because the other end of the connection is closed. In django 1.4, http response is lazy, as well, so even writing directly to it will probably not raise an exception until the view has returned, anyway. Ian > Cheers, > > John > > -- > You received this message bec

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-20 Thread Ian Kelly
workplace, many of the tables that Django deals with are actually updatable views, which are obviously not produced by syncdb. Cheers, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-use

Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread Ian Clelland
t; No, if you have the CSRFViewMiddleware installed, then you don't need this line at all. -- Regards, Ian Clelland -- 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@googlegro

Re: model translationissue

2012-07-12 Thread Ian Clelland
tally, I'm sure): once as the first argument, and again as a named parameter. If the argument "_('name')" is supposed to be the field label, then you should pass it explicitly as that keyword art, like this: name = forms.CharField(label=_('name'), max_length=1

Re: Ignore apostrophes using django-postgresql

2012-07-20 Thread Ian Clelland
The queryset's extra() method can help you with that: MyModel.objects.extra(where=["replace(db_column_name, '''', '') = %s"], params=["rockn burger"]) (Be careful if you're typing that in manually -- there are lots of single-quo

Catch or raise exception designissue

2012-07-31 Thread Ian Clelland
should never deliberately be creating 500 errors. The only responsible thing to do when a 500 is seen in the logs is to track down the source of it and fix the bug. -- Regards, Ian Clelland > -- Regards, Ian Clelland -- You received this message because you are subscribed to the

Re: Syncdb Error With Oracle Database - IntegrityError Exception

2012-08-31 Thread Ian Kelly
On Fri, Aug 31, 2012 at 10:03 PM, Jon Blake wrote: > Querying column timestamp of view user_objects for tables, sequences and > triggers appears to confirm my understanding of what base.py does. I'll drop > and recreate my user account, and try again. I'll advise how this goes. Does > the Django d

Re: Django on legacy Postgres database with encoding WIN1252

2012-10-04 Thread Ian Clelland
de it. Is there any other info you can provide about the error message? It may end up that you just have to clean the data in the database to be able to use it. Ian On Thu, Oct 4, 2012 at 9:57 AM, Janeskil1525 wrote: > Hi all > > I'm new Django user. I have a legacy system based on

Re: Disabling CSRF is not working.

2012-10-05 Thread Ian Clelland
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. > > --

Email new users account details

2012-10-09 Thread Ian Foote
(email address) and email the user a random password which they change when they first log in. Is this a sensible approach, and how can I do this? Thanks, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

django registration custom backend

2012-10-27 Thread Ian Foote
s because I'm not calling authenticate before login, but authenticate (https://docs.djangoproject.com/en/1.4/topics/auth/#django.contrib.auth.authenticate) requires a password, which I don't want to set at this stage. I want the user to be logged in when they are redirected to the set_p

Re: Randomly clearing database tables

2011-10-05 Thread Ian Kelly
On Tue, Oct 4, 2011 at 2:28 PM, msbuck wrote: > Below is the settings. I am fairly new to python unit testing so my > understanding of things could be better. But right now, if I select > Run As -> Python Unit Test will my project is selected, it runs all of > my Django tests and clobbers my worki

Re: django.db.models import Q help!

2011-10-21 Thread Ian Clelland
f another object, then just use that! Try something like fi = request.user.get_profile().financial_institution txn = Transaction.objects.extra( where=['(tpin=%s or teller_no=%s or identifier=%s) AND financial_institution_id=%s'], params=[value, str(value), value, fi.id]) --

Re: Using .filter() on a constant expression

2011-10-21 Thread Ian Clelland
)) )) | ( Q(dob_year_max=alive_y2+1) & ( Q(dob_month=1) & ( Q(dob_day=None) | Q(dob_day__lt=1) )) )) -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Database management commands

2011-10-28 Thread Ian Clelland
;, and you can see the engine used by all of your tables. -- Regards, Ian Clelland -- 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

Re: Long usernames in auth_user?

2011-10-28 Thread Ian Clelland
g, even though they are rarely encountered. 320 characters suffices for any valid email address. -- Regards, Ian Clelland -- 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@go

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
# yes, it is special I believe that in some cases, the exists() query can be optimized to return faster than a count() aggregation, and I think that the intent of the code appears more clearly. Ian -- Regards, Ian Clelland -- You received this message because you are subscribed to the Goog

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote: > On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote: > > On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote: > >> > >> # This is my current solution > >> if get_special_objects().filter(pk=obj.pk).c

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
ated, or you might end up with 70M objects, or anywhere in between. Again: odd, undocumented, and potentially surprising behaviour, and I'd recommend explicit over implicit, especially in this case. -- Regards, Ian Clelland -- You received this message because you are subscribed

Using the same storage backend for media and static files.

2011-11-05 Thread Ian Lewis
using the same class but with different settings. -- Ian http://www.ianlewis.org/ -- 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, se

Re: How can I serve static files while requiring Django-based access permissions?

2011-11-08 Thread Ian Clelland
pp, and you can do whatever access checks that you want to before serving it. Look up X-SENDFILE for Apache, or X-Accel-Redirect for nginx for the details. Ian > Ideally the resulting website will be fast, but I also want to hear > options that might be low performance. > > Thank you,

Re: Forbiden 403 error

2011-11-16 Thread Ian Clelland
on out of CSRF protection, then you can do that too -- it's not baked into Django that deeply. You will need to change your settings, and remove the CSRF middleware from MIDDLEWARE_CLASSES. That will completely remove this feature from your project. (and, of course, remove all of the security benef

Re: string indices must be integers, not str

2011-11-21 Thread Ian Clelland
ttings.DEFAULT_FROM_EMAIL[settings.CONTACT_EMAIL_TO]" looks like you're trying to use a string to index into another string variable. Ian -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: django.conf.urls import question

2011-11-28 Thread Ian Clelland
ing the tutorial for the development version. (There used to be a big warning about this at the top of all every page in the development docs, but it seems to have disappeared.) Try following the tutorial starting at https://docs.djangoproject.com/en/1.3/intro/tutorial01/ instead, and see how far you

Re: Boolean test on queryset

2011-11-28 Thread Ian Clelland
u 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.co

Re: Retrieve object model admin userid & password?

2011-11-30 Thread Ian Clelland
; Yes, yes and yes. If you have console access, you can also do this: manage.py changepassword username_goes_here That will allow you to reset anybody's password; superuser or otherwise. -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Grou

Re: unit tests and 'system' tests with history

2011-11-30 Thread Ian Clelland
(ab, Bees with Machine Guns, etc) that will tell you how your site performs under load. Host-based testing should be there to tell you that your site behaves predictably and correctly under normal operation. Ian > > > As you can see from my previous questions I'm used to 'non-atomic&#

Re: models.Q raising exception

2011-12-01 Thread Ian Clelland
ango_models ... GameProfile.objects.get( django_models.Q(nick=nick) | django_models.Q(user=self.user), world=self.world, ) to see if the problem goes away. If it does, it's almost definitely a redefined name. -- Regards, Ian Clelland -- You

Re: Query with no-correspondence results

2011-12-06 Thread Ian Clelland
0) from mydatabase_votecontext left join mydatabase_vote on (mydatabase_vote.context_id = mydatabase_votecontext.id) where thing='Carrot' and user='Me' There still might be a way to do it with the ORM; but you can definitely use raw sql for this. -- Regards, Ian Clelland -- You received this messa

Re: Query with no-correspondence results

2011-12-07 Thread Ian Clelland
e WHEREs (not filtering by user or thing), it still > presents without nulls (or 0.0) > Is there other way you can see? > Again, thanks > On 6 Dez, 21:48, Ian Clelland wrote: > > On Tue, Dec 6, 2011 at 1:35 PM, Reinout van Rees >wrote: > > > > > Ah! Now I get

Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
modular. > > -- > 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.c

Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
modular. > > -- > 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.c

Re: Query with no-correspondence results

2011-12-08 Thread Ian Clelland
On Thu, Dec 8, 2011 at 12:45 PM, wgis wrote: > Ian Clelland, it worked! Thanks a lot for your perseverance > > Tom's secret sauce it's not working, unfortunately =( > Just (Carrots, Flavour, 3.0) > I guess since some 'contexts' don't have an associated th

Re: Can a template extend a template?

2011-12-13 Thread Ian Clelland
html", RequestContext({"base_template": base_template...})) Template: (my_template.html) {% extends base_template %} (In a real app, I would use a base class for the view which would set the base template for every request automatically, or I would do it in a context proces

Re: Django 1.2.1 strange problem

2011-12-15 Thread Ian Clelland
transaction will be committed to the database, and if the view raises error, the transaction will be rolled back automatically. In almost every case, this behaviour will be exactly what you want. -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups &

Re: Can I escape or delimit the "{{ }}" template braces?

2011-12-19 Thread Ian Clelland
On Monday, December 19, 2011, J. Marc Edwards < marc.edwa...@nimbisservices.com> wrote: > I'd like to write a paragraph on my page that describes the {{ }} syntax, but the template interpreter is interpreting the braces. I think what you need is the {% templatetag %} tag -- it outputs template tag

Re: Django orm and no primary key

2012-01-10 Thread Ian Clelland
filter() rather than get, if you can't ever assume uniqueness - Similarly, if you have to update records, use update() rather than save(). It sounds like you want to use aggregate queries on this table anyway, so you (hopefully) shouldn't run into any issues. Oh, and don't r

Re: Please help with complex aggregation/annotation issue

2012-01-19 Thread Ian Clelland
7;], MessierMarathon.objects.filter(messier_number=x['messier_number'], nominations=x['nominations'])[0].image) for x in highest_counts) You might be better off writing raw SQL for it, though; you could probably get it all with one (convoluted) query. -- Regards, Ian Clell

Re: saving in a view

2012-01-27 Thread Ian Clelland
k that you are going to need some lines that actually update the 'this' and 'customer' object. You would do that like this: this.number = this.number + 1 or customer.reference = number Then, when you save the objects (and just use "customer.save()", the force_update=True i

Re: Django 1.6.0 over python 3: mysql?

2012-12-06 Thread Ian Clelland
port [2] [1] https://github.com/petehunt/PyMySQL [2] http://mysql-python.blogspot.ca/2012/09/a-brief-history-of-mysqldb.html -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Authenticate User with Django 1.5

2012-12-15 Thread Ian Foote
Django 1.5 ? Have you tried changing USERNAME_FIELD to 'email'? Ian -- 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

Re: Stuck

2012-12-26 Thread Ian Foote
Others have commented on your indentation. You also have a typo: votes = models.IntergerField() should be: votes = models.IntegerField() Regards, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: ORM, Oracle and UTF-8 encoding problem.

2013-01-09 Thread Ian Kelly
On Wed, Jan 9, 2013 at 3:55 AM, Jani Tiainen wrote: > Server is running Oracle Database 10g Release 10.2.0.5.0 - 64bit Production. > (EE edition) > > and charset info: > NLS_CHARACTERSETWE8ISO8859P1 > NLS_NCHAR_CHARACTERSET AL16UTF16 Sorry, I meant your web server setup. -- You receive

Re: ORM, Oracle and UTF-8 encoding problem.

2013-01-09 Thread Ian Kelly
On Wed, Jan 9, 2013 at 11:40 PM, Jani Tiainen wrote: > If we just force using force_unicode everything works except in older > versions of cx_Oracle (our server had 5.0.4 or something) connection strings > can't be unicode for some reason. Sure, that's why the check exists in the first place. Pr

Re: Setting Django to not quote table names

2013-03-06 Thread Ian Kelly
On Wed, Mar 6, 2013 at 1:38 AM, Ian wrote: > In the meanwhile, the commonly used workaround for this is to include the > schema in the db_table declaration like so: The other workaround which is mentioned in the ticket I linked but which I completely neglected to include in my reply, and w

FW:

2013-05-03 Thread Ian Foote
http://kyokushin-aoki.sakura.ne.jp/www/tvojdi.php -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this grou

Re: FW:

2013-05-04 Thread Ian Foote
Sorry for this everyone. My password wasn't strong enough. I've updated it now. Ian On 04/05/13 03:36, Kurtis Mullins wrote: Phishing Web Site (SPAM) On Sat, Apr 6, 2013 at 9:10 PM, Ian Foote mailto:i...@feete.org>> wrote: Snip -- You received this message

Re: internal server error not sending message notification

2013-05-04 Thread Ian Lewis
_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'p

PyCon APAC CFP

2013-07-03 Thread Ian Lewis
.com/event/2704/ Thanks! If anyone has questions I'll do my best to answer them. Hope to see you in Tokyo! -- Ian http://www.ianlewis.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Storages API modified_time() and timezones.

2013-10-18 Thread Ian Lewis
C or some other timezone and need to be converted. -- Ian http://www.ianlewis.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubsc

Re: Using composition in Django

2011-04-16 Thread Ian Clelland
SQL like this: CREATE TABLE "employee_employee" ( "id" serial NOT NULL PRIMARY KEY, "person_id" integer NOT NULL, "address_id" integer NOT NULL ) ; which is probably closer to what you're expecting. -- Regards, Ian Clelland -- You received this

Re: Unidirectional relations

2011-04-20 Thread Ian Clelland
their parent, without the parent having a child_set attribute. I think Mike has the right idea; using a separate 1:many table to avoid explicit fields on the child model, but, of course, SQL being what it is, it is still possible to construct a query that joins the tables and reconstructs the l

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Ian Clelland
.filter(title__icontains="test").extra(where='oe_matches(structure.smiles, "[C;!H0]")') You could encapsulate the extra() call in a function call that annotates a QuerySet that you pass to it, but it's 'outside' of the ORM at that point. -- Regards, Ian Cl

Re: Debugging a unittest

2011-04-20 Thread Ian Clelland
only the one test that you specify will actually be run. -- Regards, Ian Clelland -- 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, sen

Re: compressing uploaded file

2011-04-20 Thread Ian Clelland
to them to compress it. > > When I try to do this: > > file.write(zlib.compress(file.read())) Don't do that -- I'm pretty sure that writing a file that you already have open for reading will produce undefined results. (Also, I'd try to stay away from using 'file&

Accessing ImageField temporary file to dynamically change upload_to storage path

2011-04-26 Thread Ian Turner
I'm in need of direction to access the temporary file that is stored in memory or on disk from an ImageField/FileField so that I can read it before it gets moved to its final location. The topics I've found all deal with only modifying the storage path based on other fields in a model. My require

Re: 500 message with POST

2011-05-02 Thread Ian Clelland
sts. I believe that Django will issue the redirect anyway, buy the user agent is *not* supposed to just blindly post the data to the new URL without some sort of user interaction. To eliminate this as a possible error source, try putting the trailing "/" on the URL in the command line: $

Re: Decimal * Float problem

2011-05-11 Thread Ian Clelland
k* into a float; you should use .quantize() instead. -- Regards, Ian Clelland -- 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 e

Re: Encrpting urls to hide PKs

2011-05-12 Thread Ian Clelland
omes back to the confirmation view. If your tokens are actually random, and large enough (say, 64 bits), then anybody trying to guess them will be wasting their time. -- Regards, Ian Clelland * By looking at the database IDs, people can gauge how heavily the system is being used, or if they s

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread Ian Clelland
ailMessage, set the headers yourself, and call send() on it. (Also, 'text/us-ascii' is not a registered MIME type; you probably want to say something like 'text/plain; charset=us-ascii') [1] http://docs.djangoproject.com/en/1.3/topics/email/#the-emailmessage-class -- Rega

Selecting distinct months from a QuerySet

2011-05-18 Thread Ian Turner
Hi, I would like to get a distinct list of months from a datetime field on an already defined QuerySet. SQL that I would use manually to get distinct from all records on the model. SELECT DISTINCT MONTH(`some_datetime_field`) as `month` FROM `some_model` ORDER BY `month` I don't need the year

Re: json serialization question

2011-05-27 Thread Ian Clelland
from django.utils import simplejson as json ... records = models.Residents.objects.extra( where=[], params=[...]) data = json.dumps(records.values('fname','lname','pt')) return HttpResponse(data, mimetype='application/json') records.values

Re: SystemError from django.conf.settings

2011-05-30 Thread Ian Clelland
0.9.7.2), but I don't want to mess > around with the production environment too much, or risk breaking the > live sites. > If the error is in one of the python core modules, then it may have been fixed recently; but I haven't seen any reports of failures in tupleobject.c other th

Re: Trouble with simple aggregation

2011-06-08 Thread Ian Clelland
ticle.objects.values('category').annotate(count=models.Count('id')) ? The idea being that you group the objects by category, and then count the number of distinct ids within each category. The docs mention that the default ordering can get in the way of this sometimes,

Re: 'ValuesListQuerySet' object has no attribute 'META'

2011-06-09 Thread Ian Clelland
tring "META" doesn't even occur in the db package, so I can't imagine how simply wrapping a QuerySet in a list() call could trigger an exception like that. Can you post the rest of the code around this, or at least more of a traceback, unless that is really all that there is? And

Re: 'ValuesListQuerySet' object has no attribute 'META'

2011-06-10 Thread Ian Clelland
, and its accompanying META attribute. Check to see if that's the case, and rename your list() view if it is. -- Regards, Ian Clelland -- 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@

Re: storing django object into javascript array

2011-06-10 Thread Ian Clelland
from django.utils.simplejson import dumps ... school_list = dumps([school.name for school in city.school_set.all()]) and then add school_list to the context variables that are passed to the template. Then in the template, you can just use {{ school_list }}, and it will be a properly

Re: forms messing up css, help?

2011-06-11 Thread Ian Clelland
eponse( '/var/djcode/oneadmin/templates/oneadmissions/contact.html', {'form': form}, context_instance=RequestContext(request) ) That should give you a functioning template. Ian On Fri, Jun 10, 2011 at 9:27 PM, raj wrote: > I also noticed

Re: Could not decode to UTF-8 column 'cpostal'

2011-06-13 Thread Ian Clelland
ieval) 4. If you can get the right data out of the database in the python shell, then can you save it from there as well? If everything above works, then try doing this: > object_from_database.save() and see if you get the same error. If so, posting a traceback from that might help pinpoint th

Re: storing django object into javascript variable/array

2011-06-15 Thread Ian Clelland
JavaScript, so what you're going to have to do is come up with a sample of what you'd *like* to see as the template output, and hopefully we can help you with the Django template code to produce that output. [Also, it really doesn't help to be posting and reposting the same questi

Re: Unit-Testing Dilemma

2011-06-20 Thread Ian Clelland
t; 3. Break up your API calling code into more testable units to truly > > isolate your independent code from the API calling code. It'll be much > > easier to catch problems in the API integration code. > > -- > You received this message because you are subscribed to the

Re: Possible bug in form validation

2011-06-20 Thread Ian Clelland
here, but it is not used internally by the form machinery. > > However, this is looking like a legitimate bug to me. > > http://dpaste.com/hold/556603/ > > I've updated with a working example, as http://dpaste.com/hold/556805/ -- Regards, Ian Clelland -- You received this

Re: Unit-Testing Dilemma

2011-06-21 Thread Ian Clelland
e the tests without touching the > actual view logic, so testing what the API receives makes the most > sense to me. > If this is all for a refactoring, then you're probably on the right track there -- instrument the existing object for testing, rather than restructuring the view f

Re: Inconsistent keyword filtering on FK

2011-06-23 Thread Ian Clelland
ere's any practical difference in performance -- I would hope that any decent SQL query optimizer should be able to change select payee.* from payee join person on (payee.person_id = person.id) where person.id = 26 into select payee.* from payee where person_id = 26 -- Regards, Ian Clelland

Re: Strip_tags and non english char issue

2011-06-26 Thread Ian Clelland
If those aren't there, then your browser will have to guess the document encoding, and might be guessing wrong. Hopefully that should get you enough visibility on the problem to see what is happening. If none of that provides any clarity, then try posting those answers here, and someone mig

Re: Calling a custom templatetag inside a block/extrahead-block?

2011-07-04 Thread Ian Clelland
eived 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 o

Re: Calling a custom templatetag inside a block/extrahead-block?

2011-07-04 Thread Ian Clelland
eived 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

Re: 'settings' referenced before assignment

2011-07-20 Thread Ian Clelland
the assignment to the 'settings' variable (if you don't), or change the name of the variable you assign to (if it was an accident). -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To pos

Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread Ian Clelland
th "manage.py loaddata", or by using fixtures in tests. If there is code that absolutely has to run when a new object is created, (or code that needs to run on update, but absolutely cannot run on new objects before insertion), then you may be better off using a post-save signal handler, a

Re: object value distinct for ForeignKey

2011-07-27 Thread Ian Clelland
nct to see why you might want to be writing testDB.objects.order_by().values('country').distinct() ) > > thanks in advance, > > Alfredo > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post

Re: object value distinct for ForeignKey

2011-07-27 Thread Ian Clelland
On Wed, Jul 27, 2011 at 9:29 AM, Ian Clelland wrote: > > > On Mon, Jul 25, 2011 at 11:29 AM, Alfredo Alessandrini < > alfreal...@gmail.com> wrote: > >> Hi, >> >> I've a model testDB with a foreignkey "country" related to another >

Re: How can I use {{variable}} in custom templatetag?

2011-08-08 Thread Ian Clelland
so that the template framework actually determines what the contents of that variable should be, given the current context. The example at https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/#passing-template-variables-to-the-tag shows how it should be done. Construct a Variable object i

Re: How can I use {{variable}} in custom templatetag?

2011-08-08 Thread Ian Clelland
>The example at > https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/#passing->template-variables-to-the-tag > shows how it should be done. Construct a Variable object in > >node.__init__(), and use variable.resolve(context) in node.render() > > > >Ian >

Re: How can I use {{variable}} in custom templatetag?

2011-08-08 Thread Ian Clelland
r render() method is going to compute some value, probably a list of Entry instances in this case, and then it will create a new context variable, with the statement; context[self.related_entries] = And that is what is going to create the context variable {{related_entries}}, or {{cheeseburger_h

QuerySetManager breakage with r14389

2011-01-05 Thread Ian Clelland
presuming that the change to Django's related.py is correct, and that the QuerySetManager code just needs to be updated to properly support Multi-db, but I don't know where to start fixing it. Thanks, Ian The simplest test case I can get to reproduce this problem looks like this: fro

Re: Ordering columns in from clause

2011-01-06 Thread Ian Clelland
his kind of query. It is not valid SQL to order by a column that is not in the result set. MySQL allows you to do that, but that is a MySQL-specific feature. PostgreSQL, certainly, does not allow this, and there is no real advantage gained (aside from a slightly smaller response) by excluding the or

Re: QuerySetManager breakage with r14389

2011-01-12 Thread Ian Clelland
On Wed, Jan 12, 2011 at 6:23 AM, Russell Keith-Magee wrote: > On Thu, Jan 6, 2011 at 5:29 AM, Ian Clelland wrote: >> Hi, >> >> I've been using Simon Willison's QuerySetManager[1] pattern for a >> while now, and since upgrading to Django 1.2.4, it has been br

Re: Generate a unique username for django.contrib.auth

2011-01-14 Thread Ian Clelland
ice from it should get you 120 bits of pure random goodness. -- Regards, Ian Clelland -- 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,

Re: Query Set involving Model Method

2011-01-16 Thread Ian Clelland
se 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 >

Re: South introspection doesn't get registrered

2011-01-17 Thread Ian Clelland
MyFieldsDontWork > > Does anybody know why? Try changing the last line of your introspection rule, from > ["^core/.models/.lib.thumbs.ImageWithThumbsField",]) to something like ["^lib.thumbs.ImageWithThumbsField",]) It looks like South is not recognizing your field type, as it is using a different

Re: URLField strange error

2011-01-19 Thread Ian Clelland
URL Validator. Without some more info, this is all speculation anyway, though. Regards, Ian Clelland -- 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 f

Re: URLField strange error

2011-01-19 Thread Ian Clelland
ough a ModelForm, or are you saving the model manually? Regards, Ian Clelland -- 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 thi

Re: Django form(s) for intermediary models

2011-01-26 Thread Ian Lewis
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. > > -- Ian http://www.ia

Re: csrf cookie security

2011-02-09 Thread Ian Clelland
or not. (SSL wouldn't even help; he could construct an https:// link just as easily.) That's not how it's supposed to be set up, though. -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: csrf cookie security

2011-02-09 Thread Ian Clelland
HTTP -- but the site is already HTTPS-only, so there shouldn't be any form-handling code listening on that port. Does this threat model correspond to what you're thinking? If so, I don't see away around the CSRF protection (at least, not one that involves the victim's browser)

Re: csrf cookie security

2011-02-10 Thread Ian Clelland
ername/password) are never sent in the clear, that your session cookie is never sent in the clear, and that essentially your whole site is protected by SSL, such that a request coming in over plain HTTP, even if properly authenticated, is still rejected. Once you have this in place, the secure flag o

Re: TemplateSyntaxError at /polls/updatepath/ Caught AttributeError while rendering: 'RawQuerySet' object has no attribute 'all'

2011-02-10 Thread Ian Clelland
rs+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: TemplateSyntaxError at /polls/updatepath/ Caught AttributeError while rendering: 'RawQuerySet' object has no attribute 'all'

2011-02-11 Thread Ian Clelland
% for obj in my_raw_queryset %} {{ obj.visible_choice }} {% endfor %} -- Regards, Ian Clelland -- 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

Re: images

2011-02-15 Thread Ian McDowall
configured template path. Static files are served by your web server according to its configuration. If you are using the development web server then you need to configure Django as Praveen suggests to set the media path. if you are serving any other static content then you have already done thi

<    1   2   3   4   5   6   7   >