Using subclass of RequestContext in generic views?

2008-09-01 Thread Tim Chase
I've been trying to figure out how to use a custom subclased RequestContext[1] object in my generic views. Looking at the code of django/views/generic/*.py it looks like this class is hard-coded in each of the views. Ideally, I'd be able to set something in the settings.py to specify my defa

Re: use crypt algo for user passwords

2008-08-29 Thread Tim Chase
> Maybe I'm wrong but this patch define DEFAULT_ALGO at "django > installation" level. I think it shoud be defined at prject level. > something like this > try: > ... DEFAULT_ALGO = settings.DEFAULT_ALGO > ... except NameError: > ... DEFAULT_ALGO = 'sha1' > > does refer to project s

Re: How to view the sql query statement involved in a django web page?

2008-08-29 Thread Tim Chase
> How to view the sql query statement involved in a django web page for > optimization? thx http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running Just make sure DEBUG is False in a production environment, or this is one of the first things that will

Re: use crypt algo for user passwords

2008-08-28 Thread Tim Chase
> thanks opend ticket #8647 Attached is a patch against contrib/auth/models.py that should add an "algo" parameter to set_password so it takes an algorithm. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: Complex, somewhat formula...

2008-08-27 Thread Tim Chase
> TEAM > name > nickname > win > loss > rating > rank > > GAMES > date > away_team (fk) > home_team (fk) > away_score > home_score Shooting from the hip, with no actual data to experiment with, and not knowing your back-end SQL server, the SQL could look something like SELECT Team.*, Co

Re: Complex, somewhat formula...

2008-08-27 Thread Tim Chase
> I have a system that I created a few years back in PHP (it > actually started in VB with Excel) that goes through all the > college football games, compute a team's win/loss record, then > a "power rating" which is based on their winning percentage > and their opponents winning percentage. > >

Re: urlpatterns and generic views cheatsheet

2008-08-25 Thread Tim Chase
> It's not terribly obvious from the scribd layout, but at the > top (above the document) there's a "download" link or similar, > and there you can download the original PDF. ...which expects that I create login... Given that the source is likely just a PDF, posting a link to it somewhere is a

Re: urlpatterns and generic views cheatsheet

2008-08-25 Thread Tim Chase
> Here is a summary of all the tutorials and docs that I have > read on urlpatterns and generic views. It is a 2 page, > concise, example code based cheat sheet. > > http://www.scribd.com/doc/4975790/urlpatterns-for-django-cheatsheet Nifty, but scribd is annoying as heck. Printing from scribd w

Re: Boosting your productivity when debugging Django apps

2008-08-22 Thread Tim Chase
> This question is aimed at those of you who, like me, come from a Java > and C++ background and are used to being able to debug things with a > debugger - setting breakpoints, stepping through code, evaluating > expressions, etc. What do you find to be the most productive approach > to debugging

Re: Text Parsing Question

2008-08-21 Thread Tim Chase
> So i'm working on a view that will need to parse character > strings that will have a predictable structure, but dynamic > content. The format will look like > "%Zxx^xx?;xx? where all x are > the unpredictable characters and all the rest will be present > in

Re: looping around lists

2008-08-18 Thread Tim Chase
> This problem's kinda hard to explain, but I'll try my best. I've got a > list variable : notes_list which looks like: {'note 1', 'note2' etc..} > > I'm using this variable within a forloop and I want it to cycle based > on the number of loop (notes_list.0 for the first loop, notes_list.1 > for

Re: Is Django development active?

2008-07-20 Thread Tim Chase
>> I got that illusion due the slow official releases cycle... > > Be careful with this logic, because it is misleading. For example: > Britain has not had a new Prime Minister since June 2007; does this > mean the British Government has not done anything in the past year? Heh, the USA has been

Re: Is Django development active?

2008-07-20 Thread Tim Chase
> Why there is no active development effort in Django framework? > Last edition released at October 2007 (if I'm not wrong). I'm not sure where you get the idea that there's no active development...a quick check of the website (www.djangoproject.com) shows a flurry of activity. There hasn't b

Re: accessing an attribute for the first item in a template context

2008-07-17 Thread Tim Chase
>> example, I can do: >> >> {% for s in objectlist %} >> User name is: {{s.user_name}} >> {% endfor %} >> >> But, I can't do this: >> User name is: {{ objectlist.0.user_name }} What is "objectlist"? is it a list() or an iterable? It may be trying to index into an iterable. Thus you can eith

Re: single list items in templates

2008-07-16 Thread Tim Chase
> I have a list: data = ['apple', 'orange', 'banana'] > in my template: {{ data }} will output: ['apple', orange, banana] > but {{ data[0] }} will throw an error {{ data.0 }} should do the trick. -tim --~--~-~--~~~---~--~~ You received this message because yo

Re: templates: additional forloop variable?

2008-07-13 Thread Tim Chase
> I'm considering adding a forloop.previous (or somesuch) > variable to the supplemental variables produced by the for > tag. If forloop.first is true, this value would always be > None, but otherwise it would reference the actual loop item > from the prior iteration. I'd be tempted to do it as

Re: Authenticate against Active Directory

2008-07-10 Thread Tim Chase
> Got it setup, but when I try to login to the admin with our dummy acct > on AD, I get the error ImproperlyConfigured at /admin/ > Error importing authentication backend project.app.auth: "No module > named ldap" > > Running the latest development version of Django with Python2.5 Hmm...forgot t

Re: Authenticate against Active Directory

2008-07-10 Thread Tim Chase
> Any issues with running auth against AD? For the most part, AD is just LDAP in disguise (with MS extensions). I've been able to use LDAP to authenticate a number of Python apps against our AD at work. Thus, any "Django LDAP authentication" module/code (which I've stumbled across several t

Re: Where to put stylesheets?

2008-07-09 Thread Tim Chase
> href=" {{ MEDIA_URL }}styles.css" /> , > > 'styles.css' won't load. Just to clarify what may be obvious...do you have the correct one of these: href=" {{ MEDIA_URL }}styles.css" <- what you wrote href="{{ MEDIA_URL }}styles.css" <- likely what you want without the extra space? -tim

Re: What is the fastest way to come up to speed with Django?

2008-07-09 Thread Tim Chase
>> Any other tips to getting up to speed fast? > > With the internal code? I wish there was some silver bullet like that. I found James Bennett's page[1] on "How Django processes a request" helpful for understanding the big picture of how the pieces fit together. It helps makes sense of flow

Re: CMD output

2008-06-27 Thread Tim Chase
> I created an exe app and when it is run in the CMD there is a lot of > output of what is going on on the site. I was wondering if there was a > way for words that I write to show up and not all of the output. I'm not sure whether the output is being written to stdout or to stderr, but if it's

Re: python-admin.py startproject error

2008-06-25 Thread Tim Chase
import django django-admin.py startproject mkgps > File "", line 1 > django-admin.py startproject mkgps >^ > SyntaxError: invalid syntax Subtle difference between >>> django-admin.py startproject foo and bash$ django-admin.py startproject

Re: psycopg2

2008-06-24 Thread Tim Chase
> The problem with SQL injections shouldn't IMHO be solved at > driver level, but is an application level problem. The SQL driver is responsible for accuracy in the implementation of safe methods for escaping and/or parameter substitution, and the application is responsible for making proper us

Re: Looping through a specific number of times with a for loop

2008-06-19 Thread Tim Chase
> For example at the template level... > > {% for news in latest_news_list last 10 %} > > I'm hoping this would grab the latest 10 objects in the > latest_news_list. Does anyone know the best way to do this, or have > some examples set up I could read over? Looks like you want the slice

Re: From ASP to Django

2008-06-19 Thread Tim Chase
> boss care about the technology, as long as it works. They will > not pay for an upgrade of the back-end to newer technology, > unless I can back up this decision with valid points. So why > should they switch to something like Django? I can come up > with technological points, such as maintainab

Re: bug in Django Evolution (was "Why PostgreSQL?")

2008-06-18 Thread Tim Chase
> Django Evolution is a slightly different beast - Django Evolution > isn't part of the core Django project, and if you read the FAQ, I > don't make the claim that MySQL is equally supported under Django > Evolution - in fact, I clearly state that MySQL is a work in progress, > simply due to my pe

Re: Why PostgreSQL?

2008-06-18 Thread Tim Chase
> This may be a loaded question, but I was reading a blog post > that postgresql is the preferred database for Django. Is this > true? If so, why? I think the "preference" comes from "that's what we happen to be using, so we may be be better equipped to answer questions you might have" as there

Re: How to check if something in one array is in another

2008-06-15 Thread Tim Chase
> The two arrays are just normal dictionaries that look something like > this: > > friends = [id=1,id=2,id=3] > friends2 = [id=3] This is the first suspicious item because if it is a dictionary, the key "id" appears more than once -- something that can't happen with a dict. Sets are the usual

Re: Filtering a query based on potential arguments

2008-06-14 Thread Tim Chase
>> cards = Card.objects.all() >> if request.POST.get('brand') : >> cards = cards.filter(brand = request.POST.get('brand')) >> if request.POST.get('year') : >> cards = cards.filter(year = request.POST.get('year')) > > Scott: Very cool, didn't know that was possible. I'm sure this > does not hur

Re: why my django site doesn't create .pyc file?

2008-06-09 Thread Tim Chase
>> I think this way, apache could be a little more faster. Am I >> right? > > I don't think it will be faster. Django normally runs as a > long-standing process (either inside Apache or as a standalone > process, depending on the deployment model you've chosen). > So, unlike ordinary CGI scripts

Re: Template tag to split list evenly

2008-06-02 Thread Tim Chase
> I am building a django-app that pulls call logs from a mysql > database and displays reports, I am trying to make the reports > printable and I use a CSS that splits them into two columns on > the page. I am trying to find a template tag that will split > the lists up so that they will fit onto

Re: Template tag to split list evenly

2008-06-02 Thread Tim Chase
1) no body...this leaves the question up to a lot of interpretation. 2) what happens if the list has an odd number of items list? 3) what happens if there are a prime number of items in the list? You might also be interested in my columnize() filter[1] which could be modified to use a heuristi

Re: put columns in rows

2008-05-29 Thread Tim Chase
>> Hope this helps, >> >> -tim >> >> [1] >> http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-filters > > I have two questions. > > 1) I cannot find where must I write the register of the filter Details on creating your own filters are at the writing-custom-t

Re: time and attendance management system

2008-05-29 Thread Tim Chase
> hi...related to the same problem i also have to designe > forms,reports and tables for ma data base ...will plz guide me It's a fairly trivial process so I will guide you: 1) get a server (I recommend Debian GNU/Linux) 2) install the following: Python Django a web-server such as Apac

Re: Retrieve models from database in Django format

2008-05-28 Thread Tim Chase
> I already have a database with created tables and so forth and > I need to define data models for django. Is there any way to > do it without monkey-typing? I need something opposite to > "python manage.py sqlall ***" Sounds like you want "manage.py inspectdb" as detailed at http://www.django

Re: put columns in rows

2008-05-28 Thread Tim Chase
> I want to show my query results in rows instead of columns in > an html page, but I don't know if it's possible in templates, > because of > 12 > 34 > structure > > how can I do? I've solved this in the past by creating this filter: == from itertools im

Re: setup issues with Django

2008-05-25 Thread Tim Chase
> ImportError: No module named django.core > > I ran many google searches on this error and none of the docs came > back with anything useful to solve my challenge. > > I went to the IRC forums and they told me that Django is not on my > path. Well, i had already tried adding to my path per the

Re: "request"object within models.py

2008-05-19 Thread Tim Chase
>> how do you pass the request object to models? > > Same way you pass any argument to any function or method in > Python: write your function/method to accept the argument, and > pass it from the code that calls the function/method. It's the last bit that can throw folks...many folks seem to us

Re: microsoft sql server 2005

2008-05-19 Thread Tim Chase
> is it possible to setup python/django and run it on a sql server? yes, for small values of "run"...you might call it "walking" or "crawling" (or maybe "limping") rather than "running". There has been various bits of code that allow for connecting, but SQL-Server is a bit broken in a number o

Re: Error in new project creation

2008-05-19 Thread Tim Chase
> i have set both $PATH variable and $PYTHONPATH variable to > C:\Django-0.96.2.tar\\Django-0.96.2\django My first concern is that Windows isn't terribly smart about handling .tar files. So if C:\Django-0.96.2.tar is actually a tar-file, you may not be able to get anywhere with this unless yo

Re: Error in new project creation

2008-05-19 Thread Tim Chase
> i am new to Django.After installing Django, i tried to create a new > project called 'startproject' by giving the command- > 'django-admin.py startproject mysite' > > the above command gave this error > > Traceback (most recent call last): > File "C:\Django-0.96.2.tar\Django-0.96.2\Django-0.

Re: custom SQL problem

2008-05-16 Thread Tim Chase
> I can't execute custom SQL. 'Cursor' object has no attribute > 'fechone', and 'fechall' Try "fetchone" and "fetchall" (with the letter "t") However, for your use-case, you may prefer to simply use the .values() method of a recordset: Labels.objects.values("id") as described at http://

Re: web hosting

2008-04-30 Thread Tim Chase
> If your host supports python, it should support django as well. Woah...BIG CAVEAT. I've used hosting services that only have CGI available for running python programs. While yes, I believe I've seen a hack float by that allows Django apps to be "run" within CGI, it entails horrible performa

Choosing database settings based on request?

2008-04-29 Thread Tim Chase
While playing around, I found myself wandering down this path, wondering if anybody else had been here before. In summary, I'm wondering if there's an easy way to jockey my DB settings based on information completely self-contained within the request. In longer detail... In this case, it was

Re: Missing a column out

2008-04-18 Thread Tim Chase
> I have a table full of articles. I want to select the article names (and > some > other related info) but not the actual text of the article, because I'm just > outputting a list on my web page. Is there a way to supress a single field > from the result model objects? Sounds like you're l

Re: Enterprise applications with Django

2008-04-16 Thread Tim Chase
> Did you use any open source (or commercial) tools/ framework > for dynamic reporting? Or did you build on your own? Which > tool/framework did u use? Most of our dynamic reporting was HTML based. We do have some that exported to "Excel XML Document" format (not OOXML) which was easy enough to

Re: Enterprise applications with Django

2008-04-16 Thread Tim Chase
>> If the question is "can it handle business logic rather than >> just be a system for writing blog software and news sites?" >> then most certainly. Several of the Django sites I've >> authored (they're internal rather than public-facing) for my >> company which are far more process-oriented in

Re: Enterprise applications with Django

2008-04-16 Thread Tim Chase
> Is it possible to create enterprise applications (in the same context > of Java EE applications, highly concurrent, distributed ...) with > Python? > I'm still playing around Python but it seems to it is best fits in > public web sites (YouTube), news sites, forums ... while "enterprise" is a r

Re: I'd like to learn more about Django internals

2008-04-12 Thread Tim Chase
> You might be thinking of this flowchart: > http://www.djangobook.com/en/1.0/chapter03/#cn60 Yes, indeed. Must have had the wrong list of search-terms in Google's image-search. :) Thanks, -tim --~--~-~--~~~---~--~~ You received this message because you are

Re: I'd like to learn more about Django internals

2008-04-12 Thread Tim Chase
> As the subject says, I'd love to learn more about how django > works internally. One of the best pages I've found detailing this: http://www.b-list.org/weblog/2006/jun/13/how-django-processes-request/ There was a nice image/flowchart I stumbled across once, but I can't disinter it from the w

Re: Images and Stylesheets

2008-04-11 Thread Tim Chase
> I started learning Django at PyCon in Chicago and have worked > most of the way through the "Django Book" and Sams "Teach > Yourself Django", as well as "Head First HTML with CSS and > XHTML". It's been quite a lot for this old dog, but I'd like > to take a crack a writing my own web site u

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

2008-04-09 Thread Tim Chase
> yeah but the thing is XLS spreadsheets have a lot more > meta-data than CVS can handle I've found the easiest way for us was to use the "XML Spreadsheet" option (available via the Save As->Type drop-down in at least Excel 2003 if not 2000, and readable in 2007 too). It's fairly easy to reverse

Re: Set Index (Home) Page

2008-04-07 Thread Tim Chase
ichbindev wrote: > I am trying to write urlconf file so that there is an index or home > page. If none of the patterns match, it should, by default, go to that > page. For example, a sample urlconf could be > > urlpatterns = patterns('', > (r'^time/$', current_datetime), > (r'^time/plus/(

Re: Update to many registers

2008-04-07 Thread Tim Chase
> I've read that in the queryset-refactor branch is an .update > method for the queryset, but it isn't some workaround (other > than raw SQL) for the current HEAD branch? I believe that outside the QSR branch, the workaround *is* to use raw SQL. That's part of why it's being refactored :) -tim

Re: order by field1/field2

2008-04-07 Thread Tim Chase
>> how can i do: >> >> objects.order_by(f1/f2)?? > > What does "f1/f2" mean? > > You can do objects.order_by('f1','f2') I think the OP is looking for something like this 100% untested code: MyModel.objects.extra( select={"scaled": "f1/f2"} ).order_by("scaled") which would sort b

Re: filter issue

2008-04-07 Thread Tim Chase
> TableName.objects.filter(fieldname_gt, val) I think you mean TableName.objects.filter(fieldname_gt=val) > But i want to be able to do the following: > > TableName.objects.filter(fieldname + "__gt", val) Here's where Python's keyword/dictionary expansion[1] becomes helpful: params = {

Re: Django on a shared host

2008-04-06 Thread Tim Chase
h a tar-ball down to the server, un-tar/gzipping there. This still all assumes that your webhost has support for running Django (either mod_python, mod_wsgi, or some other supported non-CGI variant) > Thanks. Hope this helps. For the list archive purposes, I've included my original em

Re: FormWizard and clean

2008-04-04 Thread Tim Chase
> I am using a FormWizard with two simple forms. The first form > has some complex validation to do on two of the fields, so I > put that code in clean(). That all works fine. > > After the second form has been submitted, it appears that the > clean() is called on the first form again. This hap

Re: Union queryset

2008-04-03 Thread Tim Chase
> I need to concatenate 2 querysets, i mean, i need to perform > an sql UNION. > > Is it possible to do it with django api? The common ways to do this are to use either a logica OR to combine them, or to use itertools.chain() as in m1 = MyModel.objects.filter(field1__icontains='foo') m2

Who tests the testers...

2008-04-02 Thread Tim Chase
Following Russ Magee's suggestion[1] regarding custom test-runners, I'm trying to figure out how to test my test-runner. I dug around in the Django source, but I didn't see anything in the tests/ directory that exercised the existing test-runner to ensure that it doesn't fail spectacularly.

Re: Get number of the day

2008-04-01 Thread Tim Chase
> A date anyone, how to get the number of the day that corresponds from which starting point? day of the year? day of the week? day of the month? Reading up on Python's strftime() method of datetime objects [1] may point you at what you need. Small caveat regarding current breakage for dat

Re: How to create test suite for entire website consisting of many apps

2008-03-07 Thread Tim Chase
> I know that using manage.py I can do something like: > >> python manage.py test >> python manage.py test >> python manage.py test > ... and so on. > > But if I have several applications in my website (project) it would be > easier if I could just run them all together, but the following > d

Re: Documentation Project [No django directly related]

2008-03-05 Thread Tim Chase
> I'm building a complex Web site using Django of course, and I > have to start the documentation this week. I'd like some > suggestions about this. I want to make the documentation > available through the web and a PDF file. I've found that there are two over-arching categories of documentati

Re: Getting a UNION query in Django Models?

2008-02-25 Thread Tim Chase
> How do I do something like this using Django Models? > > SELECT name,birthdate FROM friends >UNION > SELECT name,birthdate FROM enemies >ORDER BY birthdate, name; several alternatives: Use a custom manager:

Re: Domain Parsing Question

2008-02-18 Thread Tim Chase
> I'm having an issue parsing the sub domain from a lot of non-US urls. > In the US the format is always subdomain.domain.sufix or > domain.sufix. Easy to parse. > > In the uk for example though the format is > > subdomain.domain.co.uk or > domain.co.uk > > My issue is that i'm parsing the do

Re: Django authentication, virtual hosts, sites and SaaS

2008-02-18 Thread Tim Chase
> 1. I need basecamp-esque URLS i.e. [instance].maindomain.com where > [instance] is an "instance" of the application. I've looked at the > sites feature for this but I'm not 100% sure it's suitable with > constraint (2) below. Is there any (optionally anecdotal) evidence > either way to sugges

Re: "Presales" questions

2008-02-18 Thread Tim Chase
>> I've coded in PHP, and I've coded in Python. I'd choose >> Python over PHP any day. As a matter of fact, I don't touch >> PHP any more unless I'm paid to (or maintaining some of my >> old personal PHP code). > > May I ask why this disdain for PHP? OOP type puritanism aside, > it's a language

Re: "Presales" questions

2008-02-16 Thread Tim Chase
> Reading the website, it seems Django is not a readymade CMS but a > "framework". More like CodeIgniter from the EE guys. I know nothing about CI from EE, but Django is as you describe: "not a ready-made CMS, but a framework" > My requirements are as follows. I would appreciate if someone can >

Re: How to make a simple employee attendance management system using Django?

2008-02-13 Thread Tim Chase
> Manual imput (e.g. a form for employee id and password) would > not be too hard, just watch out for employees punching their > late friends in. Swipe card or biometrics might get a bit more > hairy, I know nothing about this but I am pretty sure this > could be done. From what I have seen, a

Re: Creating password protected RSS feeds

2008-02-11 Thread Tim Chase
> > How can I create passwords protected feeds with Django? I guess I > > will have to go beyond the contrib.feeds framework, but if some one > > has any recipes/links to how to do this, it would be most helpful! > > Use your own custom view to render the feed, and just wrap HTTP auth > aroun

Re: Django cannot be used by large web sites?

2008-02-11 Thread Tim Chase
> Error while importing URLconf 'company.urls': more than 255 arguments > (urls.py, line 339) It might help to include a slice of your urls.py for the statement(s) surrounding line 339. And perhaps signatures of called code. There are a couple possibilities that occur to me, but without seei

Re: Using a filter with many to many relationship

2008-02-10 Thread Tim Chase
>>offers = Offer.objects.all() >>for term in ('ThemePark', 'London'): >> offers = offers.extra(where=[""" >>EXISTS ( >> SELECT 0 >> FROM app_offer_term ot >>ON o.id = ot.offer_id >>INNER JOIN app_term t >>ON ot.term_id = t.

Re: URL naming for multiple-word object's names

2008-02-04 Thread Tim Chase
> http://example.com/reports/// > > I don't want to use category and subcategory IDs because that's not "the > Django way", but when using names as URL parts I also get "ugly" URLs like: > > http://example.com/reports/Real%20Availability/... It sounds like you're reaching for a SlugField, prep

Re: Read-only connection to database. How to?

2008-02-03 Thread Tim Chase
> I found a trick that works for my use case. I just don't execute if > it's not a SELECT request. I do the test like so: > > def execute(self): > if self.sql.split()[0].lower() != 'select': > return 'You can only execute SELECT queries.' > So the user puts

Re: Heads-down transaction-processing apps on Django

2008-02-02 Thread Tim Chase
> Yes. This is really easy for stuff like Zebra printers. Hadn't thought > of it for the bigger ones needing lots of PCL but it could be done > easily enough with a little work to abstract some of the basic drawing. There are some other add-on Python libraries that, as long as your printer supp

Re: Heads-down transaction-processing apps on Django

2008-02-01 Thread Tim Chase
>> Not quite as much flexibility here. HTML defines accelerator >> keys which are browser-specific (sometimes Alt+letter, sometimes >> control+letter, or other combos). > > This is perhaps the only disappointing news from your experiences. I've found this isn't quite so important as long as the

Re: Heads-down transaction-processing apps on Django

2008-02-01 Thread Tim Chase
> - Lots of data entry yes...we've got some data-entry folks that are using one of the apps I've written, pulling information off paper phone-bills (for those we can't get electronically) > - What about data entry into a web form. Data entry people use 'Enter' > to move between fields, not Ta

Re: Looking for a security/encryption programmer for small contract

2008-02-01 Thread Tim Chase
> Emanuele, your said : As for safety, nothing is safer than OTP, but > are we sure that your customer > is able to go to great lengths to distribute long key streams over a > perfectly safe channel to the sales representatives? > > Isn't the encrypted string secure? > > The method to send the s

Re: sudo under django or better solutions?

2008-02-01 Thread Tim Chase
> mm... sudo is a much more fine grained way of granting permission. I don't > really like do give all power to a web application. > > What I would have liked was a sort of sudo module, so execute certain > *configured* funcions with more power. Another option might be a long-running process (L

Re: Dynamic Parameter Names

2008-01-30 Thread Tim Chase
> I'm new to python and django and I'm trying to do dynamic queries. > Can't quite get it to work right, however. This is what I'm trying to > do. > > field = "desc" > query = User.objects.filter( field = "john") > > but meaning `field` the variable, not the column. I don't think that > python

Re: Newbie Question

2008-01-29 Thread Tim Chase
>> 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 property. Fortnately, Python makes

Re: Newbie Question

2008-01-29 Thread Tim Chase
> 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 a

Re: best practice to construct 10x10 grid

2008-01-29 Thread Tim Chase
> I have grid 10x10 populated with int>0. > Currently I'm avoiding modelforms all together and doing my own > processing, definining it as array and rendering with > loop, custom checking with my own validators outside of database > Model. Well, you can make a custom template tag that takes your

Re: check if model instance exists

2008-01-28 Thread Tim Chase
> Is there a better way to check if there are any hits on a query than > using query.count()>0 ? > > I find myself doing something like this a lot: > modelList = MyModel.objects.filter(someMember=m) > if modelList.count() > 0: > return modelList[0] This sounds an awful lot like the .get() meth

Re: Naughty word filter

2008-01-25 Thread Tim Chase
> I'm preparing my site for general consumption and would prefer that > naughty words not be presented in usernames or on public pages. Is > there a recommended way of filtering out the uncouth? Django comes with a naughty-word filter/validator, hasNoProfanities. Just set the PROFANITIES_LIST in

Re: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase
> i'll be honest, i don't know anyone who's ever used a one-time-pad ooh...terminology clarification: OTP = one-time password OTP = one-time pad The former is a common tool used for safely logging in over an insecure channel (such as using S/Key when logging into my OpenBSD box over telnet).

Re: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase
>>> - Take a message, encrypt it using a secure method (should be better >>> or equal than OTP), return the encrypted message. > > >> parties, Blowfish and DES3 are popular choices and likely to be > > just a point of fact: neither of these are >= to OTP. They're all strong cryptographically,

Re: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase
> I'm building a web application for one of my clients with django. But > I need to do something that I have never did before and I am somehow > really short on time to learn it. > > So I am looking for someone who has experience with encryption/ > security in python. It is to be incorporated int

Re: Problems setting mutliple filter for a model

2008-01-21 Thread Tim Chase
> You get my problem right. I'm searching for a way to apply a > filter on already filtered list of products. But don't know a > way to do that. Here's the solution I've proposed to this in the past: http://groups.google.com/group/django-users/browse_frm/thread/8e265aeb33f3ec32/5c169c88eef79409#

Re: best practices for a production site

2008-01-20 Thread Tim Chase
> This also may be a good time to consider a distributed version control > system (Like bazaar or mercurial)... we're just about to finish > porting to bazaar after running up to several situations just like > yours. I second this suggestion. Mercurial is currently at the top of my pick-list for

Re: These waters are friendly after all

2008-01-18 Thread Tim Chase
>> The trick: Debian redirects django-admin.py to django-admin. And, as >> Forest Bond points out, django-admin is in a shell-executable path. > > Yup - because debian policy dictates that things in /usr/bin should > *not* have an extension telling you which language they're implemented > in (*wa

Re: These waters aren't so friendly after all

2008-01-17 Thread Tim Chase
> I'm still having a problem since my shell can't seem to find django- > admin.py. I know it's there; found it in /usr/share/python-support/ > python-django/django/bin. Just to prevent other "dunder-headed mistakes", I presume it's truely named "django-admin.py", not just "django-admin". :) You

Re: Private (owner) vs. public records

2008-01-17 Thread Tim Chase
> I fully agree with you. This is generaly not a very good > design, but i think we can do some exception for a very > specific problems. For example, i found this very handy, when > we have to support a multilingual db: getting the current > language like this and use it to select the right value

Re: [beginner] Commonly used variables.

2008-01-15 Thread Tim Chase
> The thing is, in my sidebar I want to display all the categories. This > sidebar is the same for every view. How do I create the variables > needed for this recurring sidebar? So that in every view I can > generate a list of all categories in the database? It sounds like you're interested in on

Re: Define a model without any primary-key

2008-01-14 Thread Tim Chase
>> Maybe this is an irrelevant question, but I have to define a model >> for an application without any primary-key. Is such definition >> possible in "Django"? Because I have to make a model from the below >> MySQL table which doesn't have any primary key > > django is for programmers - perfect

Re: Performance / Memory/CPU Usage of A Django App with 10,000+ Models in a High Traffic Site

2008-01-14 Thread Tim Chase
> I'm developing a large webapp using django. One of my requirements > is > that it needs to be able to handle 10,000+ different entities or > models that need to be associated with a user. A single user have > needs to be able to to associate himself with any of the existing > models and have on

Re: How are the ids for Django models calculated?

2008-01-11 Thread Tim Chase
> Django adds an ID field to all models by default. Some questions about > that. > How are the values calculated. If Django asks the DB to provide it > those values, can we be sure, for all supported backends, that > 1. The ids are auto incrementing, (and not just unique). If you let Django autom

Re: Print view

2008-01-08 Thread Tim Chase
> I have a view that will generate a pdf based on one of my objects. > I'd like to have a link to this view from the admin interface. > The only way I know to accomplish this is to modify the admin template, > and display a link based on the name of the model, as determined by the > template log

Re: read only in Admin interface

2008-01-08 Thread Tim Chase
>> one application I would like only to read the model and could not >> use Create, Update and Delete capabilities. Would somebody tell me >> how I can solve this problem by using of Admin interface? > > As you'll find by searching the archives of this list, this is not > something the Django a

Re: Should logic appear in views.py

2008-01-07 Thread Tim Chase
> Does the function operate on a single model? Will it be run when you > already have the instance of the model? To add to Collin's comment, it doesn't even have to operate on a single model. It simply has to be a property of the model itself. Thus, it would make sense to have something like

<    1   2   3   4   5   6   7   >