Re: Obfuscate HTML..?

2009-05-25 Thread Chris Czub
What reason do you have for this? Security through obfuscation isn't a good strategy, especially with something as intrinsically open as HTML. If your site can be hacked just by being able to view the HTML then you have bigger problems to worry about than obfuscating it. On Mon, May 25, 2009 at 4

Re: Drill down combo boxes (Country, State, City)

2009-05-31 Thread Chris Moffitt
You want a chained select form & will need to use javascript to do it. I prefer jquery and have used the one here - http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/ The code demos are for PHP but it's simple enough to apply to Django. -Chris On Sun, May 31, 2009

Re: Logging to Database while using @transaction.commit_manually decorator

2009-06-07 Thread Chris Stoyles
ecute an insert statement via the database cursor the transaction management will still take place, is this correct? Cheers, Chris On Mon, Jun 8, 2009 at 8:11 AM, Karen Tracey wrote: > On Sun, Jun 7, 2009 at 7:44 PM, ChrisStoyles wrote: > >> >> Hi All, >> >> I just

Re: Logging to Database while using @transaction.commit_manually decorator

2009-06-08 Thread Chris Stoyles
fails (again, except for any logging that has been done). The view contains a big try/except statement and the rollback is in the "except" part. I may have to approach this a different way, because it doesn't look like I can easily do a fine-grained commit. Cheers, Chris On Mon, J

Re: Problems with view... not sure how to get the data to my template

2009-06-08 Thread Chris Stoyles
7;t execute. Are all the calls you make to net.append() supposed to be myrange.append() instead? Chris On Mon, Jun 8, 2009 at 11:46 AM, Mitch Anderson wrote: > > Below is what I have currently... it currently displays the numbers in > the range its supposed to, but tying the products

Bloxsom in Django

2009-06-09 Thread Chris McCormick
PyBloxsom developers, and thanks for their software which gave me a year of good service!). <http://mccormick.cx/news/entries/django-bloxsom> Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because y

Re: Logging to Database while using @transaction.commit_manually decorator

2009-06-09 Thread Chris Stoyles
The only log entries I want committed are the ones that tell me why a roll-back occurred. What you've said below sounds like a good enough solution, thanks for all your input. Cheers, Chris On Mon, Jun 8, 2009 at 11:38 PM, Karen Tracey wrote: > On Mon, Jun 8, 2009 at 5:39 AM, Chris

Django and CSS

2009-06-18 Thread Chris DPS
Hi, I'm new to Django. I've read the doc: http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs which is about static files but still do not quite understand what to call everything and it isn't working On my development machine, I want to use this hack and not deal with other se

Re: Should this be its own app?

2009-06-19 Thread Chris Withers
e a separate project somewhere in your system path so that > all your projects can use it. Over engineering at the start is usually > counter > productive. Interesting, I'm pretty sure I remember Jacob saying almost the exact opposite in his Django tutorial at PyCon... Chris

Switching from MySQL to PostgreSQL

2009-10-06 Thread Chris McComas
want to switch from MySQL to PostgreSQL. Is there an easy way for us to take all of our data from our MySQL and move it over to PostgreSQL? Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

bulk import limits?

2009-10-08 Thread Chris Withers
it I'll need to chunk the data up into reasonable-sized xml files. My questions is: what limits the size of the xml file that can be imported with djangoadmin's loaddata command? What would people recommend as a maximum size of xml file to use with this command? cheers, Chris --

efficiently deleting content based on how old it is

2009-10-08 Thread Chris Withers
ed services and those services associated pages? (in this app, there could be about 3 million pages that are associated with each month though a bunch of service objects) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://w

Re: iphone to website

2009-10-08 Thread Chris Withers
grant neale wrote: > Does anyone have a hint on where I should start, re: making the > website ready to receive this information? Doesn't the iPhone have a web browser? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.s

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Chris Withers
hange, so I'd like to do this through the Django ORM. Does the Django ORM have a sql abstraction layer like sqlalchemy where I can do the kind of thing you're proposing, or do I need to work with models? cheers, Chris -- Simplistix - Content

problems subclassing models

2009-10-08 Thread Chris Withers
odels subclass that. However, as soon as I did this, I started getting bizarre SQL errors, things like: ProgrammingError at /some/path relation "myapp_urlmodel" does not exist LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN "myapp_urlm...

Templating wart

2009-10-09 Thread Chris Withers
s such that I don't have to repeat the condition? DRY and all that... Chris --~--~-~--~~~---~--~~ 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@googl

Re: efficiently deleting content based on how old it is

2009-10-09 Thread Chris Withers
e over the month names more than 6 back from the > current position and delete the records. I'm keen to use "real dates" as Tim suggested. Perhaps just using the 1st day in each month as the "month"? Chris --~--~-~--~~~---~--~~ You recei

Re: problems subclassing models

2009-10-09 Thread Chris Withers
Daniel Roseman wrote: > If your base model doesn't contain any fields, you should probably > mark it as abstract. > http://docs.djangoproject.com/en/dev/topics/db/models/#id6 Thanks, knew there'd be some magic I needed t

Re: Templating wart

2009-10-09 Thread Chris Withers
british.assassin wrote: > You could do this: > > > {% for cell in row %} > > {% if forloop.first and row.url %}{{cell}} > {% else %} > {{cell}} > {% endif %} Then you're violating DRY on {{cell}}, which of course may be a lot mroe complicated than {{cell}}...

required fields during object instantiation

2009-10-10 Thread Chris Withers
all last): File "models.py", line 65, in __unicode__ return unicode(self.month.strftime('%B %Y')) AttributeError: 'NoneType' object has no attribute 'strftime' :-( Chris -- Simplistix - Content Management,

Re: newbie , need some help

2009-10-10 Thread Chris Withers
he Django book while you're at it? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: Current Django tests fail?

2009-10-12 Thread Chris Withers
Tim Chase wrote: > Is there something obvious I missed? Hi Tim, I do wonder if you might get more help with these problems on the Django developers list? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplisti

Re: any open source complete django app to use as start

2009-10-12 Thread Chris Moffitt
Might as well pile on with Satchmo: http://www.satchmoproject.com -Chris On Mon, Oct 12, 2009 at 10:52 AM, Ben Rousch wrote: > > On Mon, Oct 12, 2009 at 11:50 AM, Daniel Hilton > wrote: > > > > 2009/10/12 shreko : > >> > >> I've been looking all

does this get or create code ship with django?

2009-10-14 Thread Chris Withers
Hi All, I have a function that looks like: def get_or_create(model,**kw): try: obj = model.objects.get(**kw) except model.DoesNotExist: obj = model(**kw) return model Does something like this ship with django? If not, should it? cheers, Chris -- Simplistix

hosting from /some/url in apache

2009-10-14 Thread Chris Withers
/some/folder ...gives me a 404 unless I do, I'm not hopeful. What am I doing wrong? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message be

Re: hosting from /some/url in apache

2009-10-14 Thread Chris Withers
our app you must provided full > absolutely URL to login page, I've done it settings.py: > > LOGIN_URL='//login/' Surely this should respect SCRIPT_NAME just the same as everything else? Chris -- Simplistix - Content Management, Batch Processing & P

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html url whacking like that is pretty evil... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
o an > objects.filter(), Well, cascading deletes do happen automatically with Django, so no problem there... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~

ANN - Satchmo 0.9 Released

2009-10-25 Thread Chris Moffitt
ttp://www.satchmoproject.com/docs/svn/quickstart.html Thank you to everyone that has contributed to Satchmo and I look forward to finalizing a 1.0 release. -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djan

Unit testing form validation issue

2009-10-26 Thread Chris Allen
a the debugger. Using a data dict instead of the actual request object. the is_valid() fails for two different forms on three fields (1 for one, 2 for the other). All three fields are choice fields. Dump of various relevant info is below. I appreciate any help anyone can offer. Thanks for your time,

Re: efficiently deleting content based on how old it is

2009-10-27 Thread Chris Withers
st. The legacy database was ZODB, which was the problem. The data took up about 14GB on disk in ZODB. About 1GB in Postgres Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~-

Re: Unit testing form validation issue

2009-10-27 Thread Chris Allen
Ended up populating the test database with fixtures via .json dumps. Thank you very much for your help. --- Chris On Oct 26, 6:19 pm, Karen Tracey wrote: > On Mon, Oct 26, 2009 at 4:12 PM, Chris Allen wrote: > > > Anyone have any experience with forms (ModelMultipleChoic

Re: Remote developer opportunity

2009-11-02 Thread Chris Withers
the way it sets the Reply-To header to the list address... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

why deliver .csv when you want to be delivering .xls?

2009-11-03 Thread Chris Withers
). ...or you could just use xlwt and deliver the real deal ;-) http://www.python-excel.org/ That said, I'd be surprised if the templating is the problem here, it'll be the interaction with the database that's taking the time... Chris -- Simplistix - Content Management, Batc

Django and Authorize.net

2009-12-02 Thread Chris McComas
I was curious if anyone had done any one-off payments with Django/ authorize.net, or if there were and pluggable apps out there (I know Satchmo, that's my backup plan). Thanks, Chris -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Django and Authorize.net

2009-12-02 Thread Chris Moffitt
/labs -Chris On Wed, Dec 2, 2009 at 7:17 AM, Chris McComas wrote: > Greetings, > > We have an application for our school online, just recently the > university controller and business office finally gave us clearance to > accept our application fee online, and they setup an account

Re: How to show site down for maintenance page

2009-12-05 Thread Chris Moffitt
Try this - http://code.google.com/p/django-maintenancemode/ -Chris On Sat, Dec 5, 2009 at 6:54 PM, zweb wrote: > What is the best way to show site down for maintenance page ? > > -- > > You received this message because you are subscribed to the Google Groups > "Django

Re: Format fields in list, but keep sortable?

2009-12-08 Thread Chris Lawlor
You could add a field to store the calculated size, and override the model's save method to perform the necessary calculation. Something like: def save(self, force_insert=False, force_update=False): self.size_formatted = self.width * self.height // or whatever your calculation actually is

TemplateSyntaxError: 'property' object is not iterable

2009-12-17 Thread Chris Curvey
I have my class definition that looks like class Foo: def get_bars(self): bars = [] # do something to collect bar instances return bars bars = property(get_bars) in my template, I'd like to do something like this: {% for bar in foo.bars %} {{bar.snafu}} {% endfor %}

Re: TemplateSyntaxError: 'property' object is not iterable

2009-12-18 Thread Chris Curvey
Never mind. Me am a moron. Had a totally different programming error elsewhere. It works as is it should. On Dec 17, 4:12 pm, Chris Curvey wrote: > I have my class definition that looks like > > class Foo: >    def get_bars(self): >       bars = [] >        # do someth

admin interface, foreign keys and subclasses

2009-12-23 Thread Chris Curvey
this may be beyond the current abilities of the Django auto-generated admin interface, but I thought I'd ask... I have a class called "Customer" which has a one-to-many relationship with "ServiceRequest". I've got that all working through the admin interface and it's working fine, like this: cla

{% url admin:index %} generating wrong urls

2009-12-24 Thread Chris Withers
5.2-3 Django 1.1.1 mod_wsgi 2.5-1~lenny1 apache2 2.2.9-10+lenny6 Can anyone tell me what I'm doing wrong? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are sub

Re: admin interface, foreign keys and subclasses

2009-12-24 Thread Chris Curvey
one a pattern like this? (One-to-Many, where the "Many" side can be a series of subclasses?) On Dec 23, 8:58 am, Chris Curvey wrote: > this may be beyond the current abilities of the Django auto-generated > admin interface, but I thought I'd ask... > > I have a class called

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
(although I did trace through the django.wsgi file and all the work is still done by django.core.handlers.wsgi.WSGIHandler - A workaround which solves the problem for me is to precede the WSGIScriptAlias in the apache config with: RewriteRule ^/studio$ /studio/ [R] cheers, Chris PS: I never

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
lias*'s... How can I step through execution from the django.wsgi file and see where I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the django.wsgi file won't do what I want? cheers, Chris -- Simplistix - Content Management, Batch Processing &

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
un Apache in single process mode. See > further down in same document on debugging. > > > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger If anyone can tell me how to do "httpd -X" on a debian or ubuntu host I'd be very grateful

running "httpd -X" on debian/ubuntu

2009-12-26 Thread Chris Withers
Chris Withers wrote: > Graham Dumpleton wrote: >>> How can I step through execution from the django.wsgi file and see where >>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the >>> django.wsgi file won't do what I want? >&g

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
Karen Tracey wrote: > On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers <mailto:ch...@simplistix.co.uk>> wrote: > > > If anyone can tell me how to do "httpd -X" on a debian or ubuntu host > I'd be very grateful... > > > /usr/sbin/apach

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
uot;root url without the slash" case. I have to admit, I can't see why the script name would ever need to be trimmed like that. Graham, perhaps you might be able to shed some light with your greater wsgi experience? Chris -- Simplistix - Content Management, Batch Processing & Pytho

Re: {% url admin:index %} generating wrong urls

2009-12-26 Thread Chris Withers
have mod_rewrite enabled. I don't think so, I've checked with the rewrite engine's logging and all the urls in question are being passed straight through. Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Chris Withers
Continuation wrote: > Now if I change the single quotes to double quotes, it seems to work: > (1, "I'm looking for..."), Double quotes are absolutely fine and a lot nicer to look at than 'I\'m hard to read'. cheers, Chris -- Simplistix - Content M

Re: local variable 'delta' referenced before assignment

2009-12-29 Thread Chris Withers
if isinstance(content, Tweet): > delta = datetime.datetime.now() - content.pub_time > else: > delta = datetime.datetime.now() - content.pub_date > if delta.days > 30: #failure > > > local variable 'delta' referenced b

Re: {% url admin:index %} generating wrong urls

2009-12-29 Thread Chris Withers
ch directly covered this issue so submitted a new one: http://code.djangoproject.com/ticket/12464 Sadly, Trac ate the indentation :-( cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received

Re: local variable 'delta' referenced before assignment

2009-12-29 Thread Chris Withers
neridaj wrote: > File "/Users/jasonnerida/django-apps/blog/models.py" in > moderate_comment > 142. if delta.days > 30: Okay, now the line numbered code for the whole of the moderate_comment function... Also, check you're not mixing tabs and spaces in th

Re: Photo + thumbnail

2010-01-02 Thread Chris Moffitt
You'll probably want to use one of Django's thumbnail apps. Here's the one I recommend: http://code.google.com/p/sorl-thumbnail/* -*Chris On Sat, Jan 2, 2010 at 9:48 AM, nameless wrote: > Hi everyone I have a simple question. > This is my model: > > > class

Help with Django and Apache

2010-01-05 Thread Chris McComas
I have a site built with Django, we're switching things up and will be running ExpressionEngine as our main CMS for the "front-end" / marketing piece of our site. We will have two Django apps running elsewhere on the site, one is a Course Management Software we built in house, the other is an onlin

Re: Why there are so few open-source business applications in django?

2010-01-07 Thread Chris Moffitt
Well, I don't know the answer to your original question, but if you want to help out with Satchmo (http://www.satchmoproject.com) feel free to. It's an ecommerce framework not an HR or warehouse mgmt but maybe it will meet your needs. -Chris On Thu, Jan 7, 2010 at 4:35 PM, Mohammad Tay

Re: {% url admin:index %} generating wrong urls

2010-01-12 Thread Chris Withers
davathar wrote: Unfortunately adding the rewrite rule mentioned as a work around hasn't worked for me. Please post the relevant section of your Apache config (including your wsgi *and* rewrite lines), there's no reason the rewrite rule workaround shouldn't work for

Re: Table with 4 Milions of rows

2010-01-12 Thread Chris Czub
It really depends on how you're selecting the data from the database. If you're doing something that necessitates a full table scan(like in-DB ORDER BY) it will slow you down considerably. If you're selecting one row from the database by an indexed column, then the performance will be very fast and

Re: Table with 4 Milions of rows

2010-01-12 Thread Chris Czub
at 3:20 PM, nameless wrote: > The table is queried from ajax using an autocomplete field with this > query in the views.py: > > books.objects.filter(book_title__istartswith=request.GET['q'])[:100] > > > > > --- > > On Jan 12, 8:47 pm, C

Re: Send and Receive SMS from a django app

2010-01-17 Thread Chris Withers
Alessandro Ronchi wrote: I cannot use an SMS gateway for my app (I must use a SIM and an hardware modem). Why? This is not a sane requirement for a web app... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Chris Czub
>1. my apache server on port 80 serves both a normal site (php) and the >django files. i would like to keep my normal site on port 80. is there >a way to keep it that way? as far as i understand the two servers must >be running on different ports. Look into what is called a "reverse proxy" e.g. Sq

Re: Send and Receive SMS from a django app

2010-01-22 Thread Chris Withers
rying to rack up a load of cell phones and writing to them... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" gro

1.2 alpha, multiple databases, and raw SQL

2010-01-27 Thread Chris Curvey
Is there a way to use raw SQL with multiple databases? I thought it might be something like: from django.db import connection cursor = connection.cursor(using="mydb") but that complains about an unexpected keyword arg. -- You received this message because you are subscribed to the Google Group

Re: 1.2 alpha, multiple databases, and raw SQL

2010-01-28 Thread Chris Curvey
> > from django.db import connections > > cursor = connections['mydb'].cursor() > cursor.execute('INSERT ') > > That is, the 'db.connection' object has been replaced with an index > called 'db.connections', keyed by database alias. Each of those > connections behaves as the single connection di

Division with Python/Django

2010-01-29 Thread Chris McComas
I have this view with my form: http://dpaste.com/152046/ when I try to submit the form I'm getting this error: unsupported operand type(s) for //: 'unicode' and 'int' what did I do wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: Division with Python/Django

2010-01-29 Thread Chris McComas
numbers like 40 or 4 On Jan 29, 8:43 am, rebus_ wrote: > On 29 January 2010 14:40, Chris McComas wrote:> I > have this view with my form:http://dpaste.com/152046/when I try to > > submit the form I'm getting this error: unsupported operand type(s) > > for //: 'unicode

Re: Division with Python/Django

2010-01-29 Thread Chris McComas
The form is a ModelForm, where the fields involved, all of them are DecimalField() On Jan 29, 9:03 am, Chris McComas wrote: > Changed my view to this: > > http://dpaste.com/152061/ > > This is the full error message: > > http://dpaste.com/152060/ > > The first t

Re: Division with Python/Django

2010-01-29 Thread Chris McComas
Hey everyone, here's all of the information: Here's the models: http://dpaste.com/152277/ Here's my view: http://dpaste.com/152061/ Here's the full error message: http://dpaste.com/152060/ On Jan 29, 9:13 am, Chris McComas wrote: > The form is a ModelForm, where the

help with Django model and 'choices'

2010-02-02 Thread Chris McComas
I have this model http://dpaste.com/153722/ and I have a ModelForm for it on my site. When I complete the form it saves everything as it should and displays just a detail page for each entry with all of the correct information from the Model. When I go back to edit the form, or I view it in the CR

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Here's my model form: http://dpaste.com/153728/ The info isn't being saved as an empty value. When I view my db with phpmyadmin, the correct values are in the ha_grade and hp_grade field in the db, the drop-down list on the forms is just not displaying them as being 'selected'. On Feb 2, 10:09

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Here's my view: http://dpaste.com/153735/ One thing I just thought of, is it a problem that the data for ha_grade and hp_grade are saved in the db as 4.3300 or 4. or 3.6700 but in the on my form they're like this: 4.33 or 4.0 or 3.67 ??? On Feb 2, 10:32 am, Shawn Milochik wrote: > Okay.

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Here's the view... http://dpaste.com/153735/ Could it possibly be that the grade is saved in the db as 4.3300 or 4. or 3.6700 but when I view source the select on the form looks like this: - A+ A A- B+ B B- C+ C C- CR On Feb 2, 10:32 am, Shawn Milochik wrote: > Okay. Sorry, I don

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
in my views that'd be fine as well... On Feb 2, 10:56 am, Shawn Milochik wrote: > On Feb 2, 2010, at 10:40 AM, Chris McComas wrote: > > > Here's my view: > > >http://dpaste.com/153735/ > > > One thing I just thought of, is it a problem that the data for >

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Shawn -> thnx for your help, that "hacky" fix isn't working tho... On Feb 2, 11:09 am, Chris McComas wrote: > Thnx. The reason the grade values are 4.33, 4. 3.67 etc is because > that value is multiplied by the value entered for ha_credithours and > hp_credithours. If

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Like this? http://dpaste.com/153790/ On Feb 2, 12:19 pm, Shawn Milochik wrote: > On Feb 2, 2010, at 11:49 AM, Chris McComas wrote: > > > Shawn -> thnx for your help, that "hacky" fix isn't working tho... > > Sorry 'bout that. I didn't really test

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
t the form and it's still not showing anything as for ha_grade or hp_grade. The drop-down for each still lists the value as 4.33 or 4.0 or 3.67 etc? On Feb 2, 12:51 pm, Shawn Milochik wrote: > On Feb 2, 2010, at 12:48 PM, Chris McComas wrote: > > > Like this? > > &g

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
h. Ha On Feb 2, 1:03 pm, Chris McComas wrote: > Nope. I dropped the table completely and started from scratch. I'm > still testing it out, so there hasn't been any real data entered so I > can play around with it. I dropped the table, uploaded my new models, > syncdb, and

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Again, this is my view: http://dpaste.com/153735/ I'm thinking the error is in someway related to this line: new_green.hp_coursepoints = new_green.hp_grade * hp_credithours The only thing I changed was changed hp_grade from a DecimalField to FloatField On Feb 2, 1:14 pm, Chris Mc

Re: help with Django model and 'choices'

2010-02-02 Thread Chris McComas
Gleber, I'll try that as well. If I can just figure out how to multiply total = = new_green.hp_grade * hp_credithours Where hp_grade is a FloatField (double in the MySQL db) with hp_credithours which is a DecimalField (decimal in the MySQL db) I think they'd solve the problem. On Feb 2, 2:25 pm

Re: help with Django model and 'choices'

2010-02-03 Thread Chris McComas
is a DecimalField hp_grade is a FloatField hp_credithours is a DecimalField I tried this, but no luck: new_green.hp_coursepoints = Decimal(new_green.hp_grade) * hp_credithours On Feb 2, 2:27 pm, Chris McComas wrote: > Gleber, > > I'll try that as well. If I can just figure out how to

Re: help with Django model and 'choices'

2010-02-03 Thread Chris McComas
Javier, WORKED PERFECT! THANK YOU ALL SO MUCH! :) On Feb 3, 9:50 am, Javier Rivera wrote: > Chris McComas wrote: > > I tried this, but no luck: > > > new_green.hp_coursepoints = Decimal(new_green.hp_grade) * > > hp_credithours > > Decimal can't directly

Help with math functions...

2010-02-03 Thread Chris McComas
This is kinda of a general and kind of a specific question. I have this in my view: http://dpaste.com/154208/ The first line adds up perfectly, but the second one doesn't and throws an index out of range error. What is the problem? cog.interview_score and cog.interview_score_conv are both Decim

If query field equals text...

2010-02-03 Thread Chris McComas
I'm trying to run this IF in my views, it's throwing an index out of range error. http://dpaste.com/154249/ What have I done wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.

Re: If query field equals text...

2010-02-03 Thread Chris McComas
not right and threw a bad syntax error. The field rating_recommendation is a CharField in my model/db. On Feb 3, 2:58 pm, Shawn Milochik wrote: > On Feb 3, 2010, at 2:52 PM, Chris McComas wrote: > > > I'm trying to run this IF in my views, it's throwing an index out of > > ran

Re: satchmo customization experiences? customizing existing e-com vs. roll-your-own

2010-02-06 Thread Chris Moffitt
lative difficulty of getting them done. -Chris On Sat, Feb 6, 2010 at 12:57 PM, snfctech wrote: > I'm building an order entry and tracking system for a Food Co-op for > their case and special orders. We don't need the system to be on-line > (at the moment), but many of t

How set initial form field value in the view function?

2010-07-04 Thread Chris Seberino
How set initial form field value in the view function? The initial keyword is great when defining a subclass of Form if you the initial values is ALWAYS the same. What if it varies?...I'm guessing I must set it in the view. How set this initial value in the view? Chris -- You received

How interate over just a slice of form fields in template? (I tried {% for e in form|slice:":5" %} )

2010-07-05 Thread Chris Seberino
How interate over just a slice of form fields in template? I tried {% for e in form|slice:":5" %} but it appears the slice part is just ignored. cs -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us.

Re: contrib.auth.views - n00b question

2010-07-06 Thread Chris Lawlor
You probably don't want to reference the login view to /accounts. You probably mean to do this: (r'^accounts/', include ('django.contrib.auth.urls'), That will map /accounts/login to django.contrib.views.login, /accounts/ logout to django.contrib.views.logout, etc. In general, when using an app,

Re: contrib.auth.views - n00b question

2010-07-07 Thread Chris Lawlor
pattern.reverse_dict: > File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in > _get_reverse_dict >   199.             self._populate() > File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in > _populate >   168.  

Re: [Offtopic] Design introduction

2010-07-08 Thread Chris Czub
Much like programming, it will come from experience. Practice a lot. You'll make a lot of things you aren't happy with, probably like your first bits of code :) Try to imitate things you like, and see the techniques they use to create cool designs. It, like anything else worth doing, will be easier

What causes request.session to be erased?...When you go to different view?

2010-07-09 Thread Chris Seberino
Ever time a web page is visited, a view is called and a NEW request object is passed in right? Then if I'm not mistaken, it appears you can't maintain request.session when you visit a new web page and a new view because a NEW request object is passed in to the new view right? My personal co

Re: What causes request.session to be erased?...When you go to different view?

2010-07-10 Thread Chris Seberino
Wow beautiful. Thanks. I needed that. cs On Jul 10, 12:14 am, Javier Guerra Giraldez wrote: > On Fri, Jul 9, 2010 at 11:36 PM, Chris Seberino wrote: > > elif form.is_valid(): > >        ... > >        request.session["posts"].append(form.cleaned_data) >

"SESSION_SAVE_EVERY_REQUEST = True" performance hog? Any other cons?

2010-07-10 Thread Chris Seberino
SESSION_SAVE_EVERY_REQUEST = True (in settings.py) seems to avoid a lot of potential bugs from forgetting to set request.session.modified = True when necessary. Is this a serious performance problem? If not, I would think this would be a good *default* value for Django no? Chris -- You

Help Converting a Query getting one result using .filter() to .get()

2010-07-12 Thread Chris McComas
I have this query, trying to get the next game in the future. today = datetime.datetime.now() next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] I need to use .get() if possible, instead of .filter() how can I do this? -- You received this message because you are subscribed to

Re: Help Converting a Query getting one result using .filter() to .get()

2010-07-13 Thread Chris McComas
database, in a separate query where sport=sport and opponent=opponent to figure out the historical Win/Loss record between the teams? On Jul 12, 8:15 pm, John M wrote: > Why does it matter? > > You could just say next_game[0] instead. > > J > > On Jul 12, 4:28 pm, Chris M

Re: www.djangoproject.com

2010-07-14 Thread Chris Lawlor
Nick, thank you so much for figuring this out!! On Jul 8, 11:12 am, Nick Raptis wrote: > In firefox, check your preffered language settings, in the content tab. > > If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" > or something) instead of a locale like en-US, > some dja

Comparing DateTimeField to datetime.now()

2010-07-14 Thread Chris McComas
This is my model, I'm trying to set it so that if the game is in the future, based on the field date, then to return True, if not return False. http://dpaste.com/218111/ I am importing datetime in my models.py but for some reason it's giving me nothing. I tried displaying future and nothing shows

Re: Comparing DateTimeField to datetime.now()

2010-07-14 Thread Chris McComas
I'm using it in my template... Basically this http://dpaste.com/218114/ Mainly I want to use it for the {% if %} but I tried to just show it was well and still nothing... On Jul 14, 11:49 am, Daniel Roseman wrote: > On Jul 14, 4:43 pm, Chris McComas wrote: > > > This is my

Re: Comparing DateTimeField to datetime.now()

2010-07-14 Thread Chris McComas
etime.datetime.now()' instead of 'datetime.now()' > > b> > from datetime import datetime > Then 'datetime.now()' should work correctly. > > Thanks, > Subhranath Chunder. > > On Wed, Jul 14, 2010 at 9:13 PM, Chris McComas wrote: > > >

<    1   2   3   4   5   6   7   8   9   10   >