Re: Mercurial or Git

2008-10-22 Thread Tim Chase
The OP wrote: >> which one is the Django community moving toward to, mercurial or git? >> if Django is to be moved... Because Subversion is fairly popular, but mercurial and git have svn interfaces. Thus the Django community seems to be "core Django development is in Subversion, but interface

Re: about WebServices

2008-10-27 Thread Tim Chase
> Has anyone made Webservices in Django ??? yes -tim --~--~-~--~~~---~--~~ 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

Re: about WebServices

2008-10-27 Thread Tim Chase
> maybe you can do a question more explicit ;-) like how i can make WS For anybody to be more explicit, you'd have to be more explicit yourself in what you want from a webservice. I tend to make my web-services RESTful, which makes them no different from any other HTML or XML response that my

Re: sql query to insert into table

2008-10-29 Thread Tim Chase
> Why do you want to use raw SQL? What's wrong with using the normal > Django ORM? One reason that I use in my own code is to snapshot multiple values efficiently, a'la: INSERT INTO stored_groups (statementitem_id, groupname, groupvalue) SELECT si.id, g.groupname, gv.groupvalue FROM

Re: PROFANITIES_LIST for comments

2008-11-01 Thread Tim Chase
> I use default comments form, set in settings.py: > > COMMENTS_ALLOW_PROFANITIES = True Uh...while I speak without looking at any code, or documentation, prima facie, this looks backwards...it sounds like you want "Allow profanities = False" -tim --~--~-~--~~~

Re: Date format question

2008-11-05 Thread Tim Chase
> I’ve a question about the date format in Django. > When I create a message for the users I enter the date in the > database. But when I retrieve the date it come out like this: -mm- > dd. I would like to make it like: > dd mm and the month should be printed with the name of the month, >

Re: SQL Join in Django

2008-11-07 Thread Tim Chase
> class Reporter() > id primary key > name > e-mail > ... > > class Article() > reporter = model.ForeignKey(reporter) > date > ... > > Now I want to implement the following SQL statement in Django: > > select name,e-mail,date from Reporter,Article where reporter

Re: SQL Join in Django

2008-11-07 Thread Tim Chase
> I tried your suggested solution and instead of printing the result I > use Django serializer to create an XML file. But it seems that > something is taking too > long and my browser just stalls. Is it because of select_related() > method? I have about 200 articles per each reporter. Another pos

Re: Help! Login() exceeds maximum recursion depth!

2008-11-09 Thread Tim Chase
> The function comes from > > from django.contrib.auth import authenticate, login Are you sure you've not *also* defined your own function called login? I.e. from django.contrib.auth import authenticate, login : : def login(foo, bar): do_something() I think Alex is on the

Re: how to get the hash part(string after the'#' mark) of the requesting url in diango

2008-11-13 Thread Tim Chase
>> how to get the string of "x=1;y=2 " in django from requesting url >> "http://a.cn/b#x=1;y=2";. > > I wouldn't expect to be able to get the part after the # (actually, I > wouldn't expect the browser to bother sending it) - it's a pointer for > the browser to a named anchor tag If you watch

Re: Read/Create Excel xls files using django

2008-11-13 Thread Tim Chase
> I am trying to detemine if there is a way to read the data from an > Excel xls file into django. I also need to create an xls file. Does > anyone know how that would be done ? In addition to the other suggestions on the list, Excel (at least '03, if not other versions) has a "save as XML" form

Re: Read/Create Excel xls files using django

2008-11-13 Thread Tim Chase
>> [my stuff about using XML templates with Excel] > Not trying to start a flame war, but pyexcelerator/xlwt support these > as well... No flame-war perceived...just sharing the hack I've used that doesn't involve much more complexity than a prefab template and Django's built-in templating. [S

Re: installing django on a shared server

2008-11-15 Thread Tim Chase
> When I run the installation script I get this error: > > error: could not create '/usr/lib/python2.3/site-packages/django': > Permission denied > > How do I get around this? From my understanding, "installing Django" consists purely of depositing the Django tree in the system $PYTHONPATH (t

Re: serving static file via django

2008-11-19 Thread Tim Chase
> yes..its just a transparent gif...i'm thinking of writing my > own view, which will get the visitor data and then just call > the static serve method provided by django. just dont know it > its ok inproduction env though.. I'd be tempted to just serve this file like any other static-media file

Re: Where are you developing your python?

2008-11-21 Thread Tim Chase
> Just wondering where everyone is developing there pythong code? > Anyone using development environments, if so which one? I'm from the old-school of folks that just use a text-editor (Vim in my case). I tend to run it within "screen", with the following windows/screens: - editor (vim) -

Re: path issue

2008-11-24 Thread Tim Chase
From your apache config: > PythonPath "['/var/www/webapps/django_project','/var/www/lib/ > python2.5'] + sys.path" This says that python should look in these directories for modules. > from django_project.apps.myapp.models import ModelOne, > ModelTwo, ModelThree This tries to import a module

Re: Testing dynamic templates

2008-11-25 Thread Tim Chase
> Check out django.contrib.auth.tests.views.py. Is there some master index of documentation for "if you want to test X, see Y.py or http://Z for an example of how to do it"? where X is any of a number of Django features such as models, views, templates, middleware, filters, template-tags, form

Re: No module named urls

2008-11-25 Thread Tim Chase
> I just moved my site to a production environment and i get > this error when trying to view the admin stuff. I want to say > its a path issue? If i use manage.py shell, i can import urls > just fine. Any ideas on why this error is popping up? My first thought concurs with your path issue. Wh

Re: Multiple Database

2008-11-26 Thread Tim Chase
> I am currently attempting to roll my own multiple database > support for django for a new project. I have attempted to > search for examples of this but have not found very much. > Does anyone have some examples on how I can accomplish this? There are multiple facets to "multiple database" us

Re: How to randomize a sliced query set?

2008-12-02 Thread Tim Chase
> coupon_items = Item.objects.all()[:25] > random.shuffle(coupon_items) > > doesn't word because a QuerySet object does not support item > assignment, which is used by random.shuffle. You might be able to cast the queryset as a list and then use random.shuffle: coupon_items = list(Item.ob

Re: model string reprentations

2008-12-12 Thread Tim Chase
> Sure do: it should be __str__() with two underscores on either side, > not one. And for the use-case the OP gave... >> from books.models import Publisher >> publisher_list = Publisher.objects.all ( ) >> publisher_list >> >> [, ] # Python calls the __repr__ for the display at the command-li

Re: db API where ...or...

2008-12-15 Thread Tim Chase
> when combining Django ORM criteria you get > the "...WHERE...AND..." clauses. > > How do I get the "...WHERE...OR..." clauses? > > Resorting to raw SQL? Use Q objects and OR them together: http://www.djangoproject.com/documentation/models/or_lookups/ Foo.objects.filter( Q(field1='baz')

Re: Your IDE of choice

2009-01-06 Thread Tim Chase
> What is your favorite IDE for coding Django projects? screen + vim + pdb + bash [+ lynx/dillo/firefox/epiphany for browsing] [+ sqlite3/mysql/psql for console database access] > Any ideas about PyDev and ActiveState Komodo IDE? Not tried either here. -tim --~--~-~--~~

Re: Urgent opening for Python Web Development/ programmers with Django/mumbai

2009-01-09 Thread Tim Chase
MapleSolutions.hr wrote: > We are having an Urgent opening for a leading MNC. > We are looking for Python Web Development/ Programmers with Django > experience. > LOCATION: Mumbai/ Andheri (E) In addition to Malcolm's (post on DjangoGigs) and Ronaldo's (are you considering remote workers) sugges

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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

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: 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 >>

Re: Using subclass of RequestContext in generic views?

2008-09-02 Thread Tim Chase
>> My subclassed RequestContext object plans to intercept the >> Context.__getitem__ call (wherein redaction will hopefully happen >> in my custom subclass), and thus needs to be the actual object, >> not just a dict-like object merged into the existing >> RequestContext object. > > Thinking

Re: Django questions

2008-09-05 Thread Tim Chase
>> 1) Does your webhost need to support Django specifically or >> is it sufficient if they support Python? (e.g. with CakePHP >> you just need general PHP support). > > Just Python will be enough. You can have a copy of Django in > any directory, providing the webserver can be configured to > fin

Re: Sessions and IP Addresses

2008-09-06 Thread Tim Chase
> The question is this: what does Django do when multiple > requests come in from different IP addresses that are > reporting the same session id? Does Django dump the session > data and create new session ids for the offending clients? I believe the answer is "Django does the right thing", i.e.

Re: Sessions and IP Addresses

2008-09-06 Thread Tim Chase
>>> NAT (I believe AOL did/does something like this) so requests from >>> the same user behind the NAT can appear to be coming from >>> different public IP addresses. >> >> AOL certainly does this. Either that or my own little web site has an >> astonishingly high number of different AOL users hi

Re: ANN: Updated Django Cheat Sheet

2008-09-07 Thread Tim Chase
> I printed the sheet out in duplex and was disappointed to see that the > two sides had opposite orientations. So a duplex version that would > yield a useful double-sided cheat sheet would be interesting to me. This is usually a printer output configuration option. When duplexing, you usually

Re: specifying MEDIA_URL in CSS files

2008-09-13 Thread Tim Chase
> What's the best way to use MEDIA_URL in a CSS file. For example, right > now my CSS file has something like: > > body { > background: transparent url('/media/images/bg.gif') repeat; > } > > I would like to use MEDIA_URL instead of /media/ (in a number of > places), but other than that the fi

Re: Paginator loads entire table?

2008-09-16 Thread Tim Chase
Evan wrote: > Hey Guys I noticed one of my pages taking over 50seconds to load, and > found the problem out the problem was the paginator loading a lot more > rows than needed. I was wondering if this is how the paginator is > supposed to work or if I'm doing something incorrect. > > Here's the

Re: Two Django visions running at once.

2008-09-17 Thread Tim Chase
> Is it possible to have two versions of django running at the same time > on an Ubuntu server(9.0 and 1.0)? > It is taking to long to recode, and until I do I wanted It up and > running with the old version. > I got the tar.gz from the web site, but do I have to get rid of the > new version? I d

Re: Two Django visions running at once.

2008-09-17 Thread Tim Chase
> 1. Django .90 installed so that the app works. > 2. To have this app up and running with .90. > 3. Django 1.0 installed so that I can shut down .90 and run 1.0. > 4. Run 1 so that I can recode my app for 1.0 For the dev-server, it's easy (at least in a Bash shell...for others, YMMV) Assumi

Re: where is my pythonpath

2008-09-18 Thread Tim Chase
> I need to edit my pythonpath, but where it? Which OS? And for what duration (just one shell session, or for all shell-sessions)? On *nix systems (Linux, BSD, Mac, etc), to set it across shell sessions, you usually set it in your .bashrc (or if you're using an alternate shell, in its rc fil

Re: Command Prompt

2008-09-25 Thread Tim Chase
> (I'm using windows xp home) > > I typed : C:\>django-admin.py25 into the command prompt and it comes > up with the message: > > 'C:\' is not recognized as and internal or external command operable > program or batch file. If you typed that whole string literally it was treated as

Re: database program

2008-10-04 Thread Tim Chase
> But... The tutorials I've been reading online all recommend > PostgreSQL. I don't care, I'll go that route, but the online server > I am currently using only offers MySQL. Are these two engines > compatible, or am I going to have to go against what the tutorial > advises and intall MySQL on my

Re: Djando developers in the Dallas area

2008-10-09 Thread Tim Chase
chimpera wrote: > I am in need of some Django help. Is there anyone in the dfw area who > can share there expertise? I'm in Frisco, and I believe that there are several others according to http://djangopeople.net/us/tx/ There are several other localities there: Plano, Coppell, Richardson, Dal

Re: array grouping in templates

2008-10-12 Thread Tim Chase
> I have an array and I want to use Django templating to display each > item in a table, grouped by 3 per row. > For example, if i have > arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] > Then I'd want it to show up as > > abc > def > ghi > j > > > In general, the array could

Re: Which IDE do you choose with django?

2008-10-12 Thread Tim Chase
> I am a newbie of django, and want to know which IDE is suit > for django? I second the use of a good text editor. I'm a Vim user, but if Emacs is your thing, that would do, as would any other good text-editor (some folks swear by TextMate or Notepad++). Some folks do use Eclipse (with the P

Re: passing data with urls.py

2008-10-13 Thread Tim Chase
> I tried these, but I am missing a piece: > urlpatterns = patterns('', > (r'^timesheet/(?P)/$', > 'intranet.timesheets.views.times'), > (r'^timesheet/(?P\d{20})/$', > 'intranet.timesheets.views.times'), > (r'^timesheet/(?P\d{20})/(?P\d{10})/$', > 'intranet.timesheets.views.times'), >

Re: passing data with urls.py

2008-10-14 Thread Tim Chase
>>http://docs.python.org/lib/re-syntax.html >> >> There are several good books and websites that will teach you the >> basics of regexps, and a quick search will bring back a number of >> results. > > Thank alot thats the best response I have had. Glad to help...though in a way, it's as much

Re: rename or renaming a Django application

2008-10-15 Thread Tim Chase
> I've done some coding on the project and within myapp > > but now I want to rename myapp to a more appropriate name. > > of course I cant simply rename the generated application directory > name, I would also need to change all references to the myapp. > > So, then question is, do I need to d

Re: assigning variables in templates

2008-10-15 Thread Tim Chase
> i have to check the method's return value first with an 'if' > tag than run the query again for the 'for' loop. this doubles > the load on the db what i don't like, not to mention that the > two queries may return different lists. Django's ORM should cache your query results, though it may need

Re: Dynamically changing q object

2009-01-26 Thread Tim Chase
> I have a qset object like this: > > qset = ( > Q(dst__contains=company.phone) | > Q(dst__contains=company.cellphone) | > Q(dst__contains=company.fax) | > Q(src__contains=company.phone) | > Q(src__contains=company.ce

Re: charts in django

2009-01-29 Thread Tim Chase
Chris Haynes wrote: > I need to generate some line charts and bar graphs from django. I > recall seeing a very promissing package a couple months ago and can't > find it now. [snip] > Any other ideas or comments on the above? Linux Journal's most recent print-edition had a good article introduci

Re: Postgresql v MySQL

2009-02-07 Thread Tim Chase
> Is there any clear reason for preferring one of these DBMS over the > other for use with Django (1.0 onwards). Historically, PostgreSQL has favored correctness, ANSI standards, and data-integrity while MySQL has favored speed and pluggability. For the most part, they've reached equilibrium.

Re: Changing the name of a project

2009-02-13 Thread Tim Chase
> I've written about one extreme end of this scale further over here: > http://www.pointy-stick.com/blog/2007/11/09/django-tip-developing-without-projects/ I've gotta admit that I was pretty ambivalent about Malcolm's ideas here until I needed to rename a project -- at which point the switch fl

Re: Unusual Schema question

2009-02-23 Thread Tim Chase
> The idea here is to have a central join table to allow many to > many relationships between any and all of the "object" tables > rather than have a zillion join tables and a rigid structure. > This allows me to add object tables easily down the road since > that will probably be necessary. It's

Re: Faster Database?

2009-02-25 Thread Tim Chase
> I am using django+MySql. > My job involves to write a huge number of products codes into the > MySql, code such as: ABCDEFGHI10, it is typically between 1 million up > to 50 million codes within 1 file, which need to be uploaded/ > downloaded into MySql. > > The problem for this is it takestoo

Re: Undocumented comment setting

2009-02-27 Thread Tim Chase
>> The COMMENTS_ALLOW_PROFANITIES setting is undocumented at >> http://docs.djangoproject.com/en/dev/ref/contrib/comments/settings/ > > A known omission, with a purpose: > > http://code.djangoproject.com/ticket/9530 > http://code.djangoproject.com/ticket/8794 If the preference is to prevent dis

Re: global variables in stateless applications (was "Generating dynamic csv data")

2009-03-03 Thread Tim Chase
GP wrote: > I have a view which generates a table (table_view) of the most recent > entries entered in the Test table of the database. I have the option > of querying the database and render the table based on the user > criteria as well > > Something like this: tests = Test.objects.filter(field1

Re: Django an STI

2009-03-07 Thread Tim Chase
>> class Tracker(models.Model): >>notifications = models.ForeignKey(Notification) >> >> class Notification(models.Model): >> # Common fields >> pass >> >> class EmailNotification(Notification): >>pass >> >> class SmsNotification(Notification): >>pass >> >> >> # I would be able

Re: Needed: a tidy model for varying numbers of multiple numerical values (page number refs)?

2009-03-09 Thread Tim Chase
Dave E wrote: > I have some data (page number references) that looks like this: > > 320, 387..90, 410, 500 > > or (sustituting numerical .. ranges for conventional dashes) > > 320, 387-90, 410, 500, 634 > > I'd just like to know the most Django-esque way of creating a model > for these? > > T

Re: Strip empty lines in rendered templates?

2009-03-15 Thread Tim Chase
> This template code: > > > {% for entry in entries %} > {{ entry.title }} > {% endfor %} > > > looks like this when rendered: > > > > Title 1 > > Title 1 > > Title 1 > > While it goes against my aesthetic tastes for making easy-to-read templates (I much prefer my templates look like

Re: allowing a user to delete their own account and associated data.

2009-03-18 Thread Tim Chase
> From the interactive shell, it's easy to delete a user:: > > >>> from django.contrib.auth.models import User > >>> u = User.objects.get(username='jacob') > >>> u.delete() > > So, you'd need to write a view that essentially does the above. > Remember that in views, the currently-log

Re: Value proposition of Rails

2009-03-18 Thread Tim Chase
> 1. Why choose Django over J2EE Clarity vs. complexity (I find J2EE over-the-top'ly baroque). using Python, I don't miss the compilation cycle in Java, and the astronomical number of JSRs numbs the mind. > 2. Why choose Django over RoR I prefer Python's readability over Ruby. Otherwise, bot

Re: OWNING code

2009-03-23 Thread Tim Chase
> new on here and not a tech guy, wanted to know if a company or > programmer who uses Django can claim they own the code? Just out of curiosity, what are your reasons for wanting to OWN the code? Do you want to change it? Do you want to distribute it on your own terms? Do you want to asser

Re: book.object.all() what is this?

2009-06-21 Thread Tim Chase
> I know from the tutorial that the statement is to get all of the > records in the book table. > What I don't know is where I find the syntax for all coding such as > find the certain author and get all the books written by the author. > > I thought that it is not python but some abbreviation of

Re: Using pluralize with floats?

2009-06-23 Thread Tim Chase
> Has anyone tried to use pluralize template tag with a float value? I > am thinking of submitting a patch to support this functionality. > > For instance, using the value 1.5 returns a singular suffix from > pluralize. I am implementing a real estate web application where a > house could have 1.

Re: Will future Django releases support multiple databases?

2009-06-25 Thread Tim Chase
> Right now, Django doesn't seem to support the multiple > databases on the same server or different servers. Will that > feature be available out of the box for future releases? You may want to eavesdrop on the Django Developers group (as opposed to this Django Users group) where Alex Gaynor h

Re: sorting different in postgres than in sqlite

2009-06-30 Thread Tim Chase
> Here's my query, (I'm using the stable release version of django, > otherwise I'd use "annotate" which I found is present in the > development version). > > contest = Participant.objects.extra(select={ >'contest_stats': """ > SELECT SUM(amt) > FROM contest_da

Re: Best distro for django

2009-07-03 Thread Tim Chase
> Looking for opinion of the best distro for a developer machine for > django. > > I'm on ubuntu now, its going ok. I'm having keyboard issues, and > wondering if I should put the time in on fixing it, or just ditch it > for say, pc-bsd, if thats what the cool django kids are using. I've done Dj

Re: Complex select

2009-07-07 Thread Tim Chase
> Something like this: > Query = Comments.objects.all().sort_by("submit_date")[:5] Without having the models, it's a little difficult to judge what the OP is after. However, the difference is that your version gets you the top 5 *comments*. The OP appears to want the top 5 unique "object_pk"

Fresh project, tests fail?

2009-07-12 Thread Tim Chase
Updating an older codebase to SVN HEAD, I got a slew of testing errors that I couldn't trace to my code. So I created a new empty project, tossed in some sqlite DB settings, and did a "manage.py test" which failed. It seems to be related to this ticket[1]. Steps to reproduce: bash$ djan

Re: Importing a Users List

2009-07-12 Thread Tim Chase
dononyx wrote: > I have a legacy database with a list of 500 users with passwords. Is > there anyway to import this into Postgres for use by django. How To > set the salted password is what has me stumped. How are your incoming passwords stored? Plaintext? MD5? Salted MD5? SHA1? Salted SHA1

Re: Fresh project, tests fail?

2009-07-12 Thread Tim Chase
> Overall I get the impression we're muddled on the answer to: > > Should the auth tests pass out-of-the-box, independent of other project > configuration? > > Someone making a firm decision on that would help. Personally I'd favor > "yes" as the answer, but I don't feel very strongly about the

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tim Chase
> The first problem is that the django server only receives the '/page' > part of the URL. The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path() and gets '/ > page', so that's what

Re: Retaining POST DATA

2009-07-21 Thread Tim Chase
> I am sending POST data to a view But this view has login_required > decorator enabled, So if i m user is not logged in, he goes to > /accounts/login page and when user login, al the POST data is lost. Is there > any way to maintain the actual POST data sent for view. There was a long discuss

Re: How to tell if a fields was modified

2009-07-24 Thread Tim Chase
>> How can I tell which model fields have been modified (this is, the >> difference between the Model instance and the data originally retrieved >> from the database) from inside the model's save() method? > > You can always retrieve the model by it's primary key from the db, and > then compare

Re: Middleware that injects data for template

2009-07-24 Thread Tim Chase
Stodge wrote: > Say I want to inject a piece of data into every page view. For > now, let's just say I want to inject the current time into > each page view. I write a piece of middleware that will do it. > But how? Do I modify the request? Or the view (process_view)? I understand that this shoul

Re: How to create this filter

2009-07-24 Thread Tim Chase
> Such a transformation is fine. I found that my Django has no F(). > Checking the Django doc I saw that this new feature is "New in Django > Development version". > > So I have to wait for the new version? Are there any other ways to > create such a filter? >> col1_value >= col2_value * 2 >> >>

Re: Is it possible to combine these two queries?

2009-07-30 Thread Tim Chase
> al_1 = Alert.objects.filter(creation_date__regex=today).values > ('dimension1').annotate(Sum('metric1')).order_by('dimension1') > > and > > al_2 = Alert.objects.filter(creation_date__regex=yesterday).values > ('dimension1').annotate(Sum('metric1')).order_by('dimension1') > > They are almost t

Re: Stopping people loging in twice

2009-08-01 Thread Tim Chase
> So is there a viable django solution for this problem? To build on what Malcolm was saying, the problem you have is that the only things your server knows are (1) when a user last engaged in a transaction with your server and optionally (2) when a user has intentionally logged out. #2 is ni

Re: Stopping people loging in twice

2009-08-02 Thread Tim Chase
> The main purpose for this would be to track login collisions > and make sure users aren't sharing log in info. > > If a user has a high number of collisions we can assume they > are sharing their credentials and take the appropriate > actions. There are plenty of legitimate reasons for login c

Re: SPAM/FRAUD WARNING: Do NOT open the email with subject "Django enquiry"

2009-08-10 Thread Tim Chase
David Ross @ Wolfeon wrote: > I received an email a few minutes ago with the subject "Django > enquiry." My email address in relation to django was phished from > djangopeople or the mailing list. Confirmed -- I received the same email, clearly from djangopeople (I registered there as "djangopeo

Re: Question about URLs

2009-08-10 Thread Tim Chase
> If i have a URL such as: > > (r'^(?P\w+)/blog/', include('foo.urls.blog')), > > what are the whats the purpose of the w and the +? i'm having some > problems with 2 of my urls and i think it may have something to do > with this. You'll want to read up on regular expressions. There are a nu

Re: Django for workflow

2009-08-13 Thread Tim Chase
> I would like to develop a small internal tool in my company for > telesales agents to fill in orders of different products then finance > can approve them and send them to the shipping department. I was going > to use php and dreamweaver but I have some python and django > knowledge. My impressi

Re: Specific fields in 'select'

2009-08-22 Thread Tim Chase
> How do I tell Django which fields to select from my database? It seems > to always use SELECT * FROM, which isn't ideal since I don't need all > the extra data for my project listing page, just the 'title' and > 'slug' field. read up on the .values() method. -tkc --~--~-~--~~---

Re: Appeding entire table to a backup table

2009-08-23 Thread Tim Chase
> The raw SQL is something along the lines of "INSERT INTO backup SELECT > * FROM today; DELETE FROM today;". > > Is there a Django way of doing this? I would required something > similiar to this: > todays_records = Today.objects.all() > for record in todays_records: > Backup.objects.create(

Re: Need help getting the company I work for to go with django

2009-09-01 Thread Tim Chase
> I work as a web developer at a reasonably large company in London. We > are just about to completely re brand and rebuild the companies website > (s) and implement a CMS. I'm having a meeting tomorrow to discuss > different avenues we can go down in regards to what technologies we > can use. I

Re: how to deploy an app that gets used by people in multiple time zones

2009-09-03 Thread Tim Chase
> I've created a django app and I soon am going to have users that are > in multiple timezones. My app is a task management system and it is > important for users to see dates and times with respect to their own > time zone. IE, if here in California I create a task at 3PM on Sept > 3, I want so

Re: Outputing an integer value in a template, but with some calculation done on it

2009-09-03 Thread Tim Chase
> I am trying to output a variable page_no to a template, but I want to output > page_no + 1 and page_no - 1. How do I do that? I tried to do something like > {{ page_no + 1 }} and that failed. Tried {% and %} as well, but no success. > > Surely there is a way to do this other than having to calc

Re: Zip multiple files into a zipped folder for download?

2009-09-04 Thread Tim Chase
> I've got an advanced question. I'm not sure it's *that* advanced :) > How do i create a zip file that contain multiple files and folders in > the zip file? You can use Python's built-in zipfile[1] module. import cStringIO as cs import zipfile as z f = cs.StringIO() # or a file on di

Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-04 Thread Tim Chase
> I personally don't have any experience with PostgreSQL and I'm generally > working in a mixed MS and Linux environment. I'm interested to hear peoples > views on the pluses and minuses of the two different systems. I'm a bit of a > query geek too. How does that play in? I know in MySQL there are

  1   2   3   4   5   6   7   >