Re: Django Interview Questions

2012-09-05 Thread Tim Chase
On 09/05/12 09:05, Dimitri Gnidash wrote: > This seems to be a copy-paste of Django FAQ. It seems to be a copy/paste of a LOT of sources around the web, not just the Django FAQ :-) -tkc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: How well does South work in a team?

2012-08-16 Thread Tim Chase
On 08/16/12 08:58, Paul Backhouse wrote: > On Thu, 2012-08-16 at 10:39 -0300, Tomas Neme wrote: >> Well, if you push without pulling, this might happen, > > *Implicit git usage* :D > > I'd expect git to squeal about it being a non-fast-forward commit. Git should, though other VCSes might notice

Re: union of two QuerySets

2012-08-01 Thread Tim Chase
On 08/01/12 10:28, Àlex Pérez wrote: > Hi, > > it's better Person.objects.filter(models.Q(first_**name__startswith='mic'), > models.Q(first_**name__startswith='joh')) > (only one query...) I'm pretty sure this will get you the intersection (it uses AND) rather than the union (which would be usin

Re: Url regex keeps django busy/crashing

2012-07-28 Thread Tim Chase
On 07/26/12 09:45, Joe wrote: > url(r'^(?P(\w+-?)*)/$', 'detail'), > > replaced with: > > url(r'^(?P[\w-]+)/$', 'detail'), Russell gave you good background on the why (including that Django was stung by the same issue). It would help if you more clearly defined what you wanted to target. Your

Re: Use regular expression to retrieve all image tags from a given content

2012-07-04 Thread Tim Chase
On 07/04/12 08:30, Melvyn Sopacua wrote: > On 4-7-2012 3:03, Tim Chase wrote: >> [snip Tim's obscene regex] > > Aside from the \b matching positive against ><, I'm not sure I follow...the \b just requires that a word-boundary occur there, preventing it from match

Re: Use regular expression to retrieve all image tags from a given content

2012-07-03 Thread Tim Chase
On 07/03/12 13:55, Melvyn Sopacua wrote: > On 3-7-2012 20:38, Tim Chase wrote: >> < img ... > > > Which should fail. It depends on what the OP is using it for. If it's just for extraction of images on the page to list them out, and such a tag comes through, then th

Re: Use regular expression to retrieve all image tags from a given content

2012-07-03 Thread Tim Chase
On 07/03/12 12:57, Melvyn Sopacua wrote: > On 30-6-2012 15:23, Sunny Nanda wrote: > What you're looking for is: > prog = re.compile(r'') > matches = re.search(prog) > for match in matches : > print match > >> On a sidenote, you should not be using regular expressions if you are doing >> any

Re: replace or regex

2012-06-28 Thread Tim Chase
On 06/28/12 01:42, pakyazilim wrote: > i have text ; > ** >A > > B > > > ** > * > * > *i want to remove first end for text end tag. * > *how can i it?* Depends on what you want to happen in various odd edge-cases: - what happens if other tags surround the outside bl

Re: Scaling django installation

2012-06-01 Thread Tim Chase
On 06/01/12 09:17, Subhranath Chunder wrote: > (Given the fact that the server is deployed in Amazon EC2 > Singapore location, as m1.xlarge with all it's network, memory > constrains in place) A couple of the other aspects that occurred to me: Is there geographical separation between your Django/

Re: Scaling django installation

2012-06-01 Thread Tim Chase
On 06/01/12 09:17, Subhranath Chunder wrote: > On Fri, Jun 1, 2012 at 6:57 PM, Tim Chase > wrote: >> 2) I/O >> 2a) disk >> 2b) network >> 2c) memory >> > Don't think these might be creating much bottleneck in my scenario. But > still, nothing like

Re: The Prettiest Pink Pony in Town

2012-06-01 Thread Tim Chase
On 06/01/12 05:16, Jani Tiainen wrote: > Since summer seems to arrived (I just saw young elk running at the back > yard of our office). I decided to type in magical words "pink pony" in > youtube search. > > > Here is what I found. Enjoy! > > http://www.youtube.com/watch?v=vY14EGd71FY There a

Re: Scaling django installation

2012-06-01 Thread Tim Chase
On 06/01/12 03:56, Subhranath Chunder wrote: > With that in mind, how should we measure response complexity? > Any particular parameter, scale? Probably I can measure against > that, and share the numbers to shed more light on how many > requests can be handled in with a particular hardware config.

Re: Upgrading to 1.4, now a test is skipped?

2012-03-27 Thread Tim Chase
On 03/27/12 18:22, Russell Keith-Magee wrote: On 28/03/2012, at 2:02 AM, Tim Chase wrote: I'm in the process of upgrading from 1.3 to 1.4, and noticed that my test results now say that one of the tests is being skipped. Any way to tell "./manage.py test" to be verbose, or to

Upgrading to 1.4, now a test is skipped?

2012-03-27 Thread Tim Chase
I'm in the process of upgrading from 1.3 to 1.4, and noticed that my test results now say that one of the tests is being skipped. As best I can tell, this is an internal Django test, rather than one of mine. Since it's not an actual failure, I'm mostly curious about what it is and what trigger

Re: Django vs. Ruby on Rails

2012-01-27 Thread Tim Chase
On 01/19/12 09:59, Brian D wrote: 1) Comparing the framework to Django; In the broadest strokes (and from my understanding of it), Rails defaults to introspecting your database and building internal models of it while Django specifies models first and then builds the database out of it. Dja

Re: What am I doing wrong with this URL Pattern

2012-01-27 Thread Tim Chase
On 01/19/12 03:36, Django Newbie wrote: Example. url(r'^People/Info/(?P\d+)/$', 'iFriends.People.views.details'), url(r'^People/Info/(?P[a-z]{3})/$', 'iFriends.People.views.detail_name'), It works with numeric value. if I use "http://localhost:8000/ People/Info/1/" but not with if I use http:

Re: Should someone with no programming experience start learning Python, or Django (along with Python) first?

2012-01-27 Thread Tim Chase
On 01/17/12 15:40, Steve wrote: Just as the title says, I have basically no programming experience. I want to program purely for the web. I know a bit of HTML, CSS, and very minimal amounts of Java. Can I start learning Django first and go from there? Is that a bad idea? Since Django is wri

Re: Pinax or Straight Django

2012-01-17 Thread Tim Chase
On 01/17/12 01:12, Kevin Miller wrote: I have been struggling between using Pinax or Straight django to develop my apps. I have never used Pinax, but was reading on it. I have already only developed one website in django although it is not yet launched. I'm not sure it's an either/or propositi

Re: List of Django release dates?

2011-12-11 Thread Tim Chase
On 12/10/11 23:32, James Bennett wrote: Or just view this handy all-in-one page: https://code.djangoproject.com/log/django/trunk/django/__init__.py Thanks, James...that's what I was hunting and unable to find. I knew the information was around and that releases were announced, but extractin

List of Django release dates?

2011-12-10 Thread Tim Chase
After a bit of googling around, I was unable to come up with a catalog of release dates for various versions. I was mostly just interested in things like for release in "0.95 0.96 1.0 1.1 1.2 1.2.6 1.3".split(): print release, get_release_year_and_month(release) sort of information, tho

Re: Large Queryset Calculation In Background?

2011-11-22 Thread Tim Chase
On 11/22/11 17:04, Nikolas Stevenson-Molnar wrote: I wouldn't expect it to lock the database (though someone with more database expertise should address that). I /would/ expect it to consume significant CPU. If you're on UNIX, you could address this issue by making your process 'nice' There's a

Re: help_text line continuation

2011-11-14 Thread Tim Chase
On 11/14/11 00:27, Mike Dewhirst wrote: I have been using the Python line continuation symbol +\ in my models help_text when my text goes beyond column 80 in my editor. I just accidentally omitted it for a continued line and discovered it doesn't seem to be needed!!! Is that a feature of Django

Re: CSRF failures for users that block all cookies. Is my planned solution stupid?

2011-11-08 Thread Tim Chase
On 11/08/11 01:13, Kevin wrote: These ~5% of your userbase is most likely like myself, where I block all cookies and add specific sites to an exception list. ... Another idea is to fetch the form via AJAX and render it using Javascript onto the page. Just a note: if these ~5% are taking the p

Re: Using .filter() on a constant expression

2011-10-21 Thread Tim Chase
On 10/21/11 13:58, Ian Clelland wrote: If you don't want to do that, then just use python to selectively include or exclude the other Q objects (that you wanted to depend on your comparison): Using your code as a base, I would do something like this: (I don't know if this is correct; I get a hea

Re: sprintf in python (not strictly django, but used all the time in django webapps)

2011-10-20 Thread Tim Chase
On 10/20/11 13:17, Cal Leeming [Simplicity Media Ltd] wrote: So, just out of curiosity, how many other people didn't realise you could do this: print '%(language)s has %(number)03d quote types.' % \ ... {"language": "Python", "number": 2} Instead of this: print "%s has %03d" % ( "pyth

Re: .count() returning unexpected results

2011-10-20 Thread Tim Chase
On 10/19/11 20:35, Tim Chase wrote: Perhaps I should have changed the test to be more clear, instead of using results = m.Person.objects.filter( Q(name__iexact=alias) | Q(aliases__alias__iexact=alias) ) self.assertEqual(1, results.count(), "Failed #%i

.count() returning unexpected results

2011-10-19 Thread Tim Chase
Querying for .count() on a result (len(results) will also trigger the issue) that pulls in a FK table throws off the count. Sample code, tests and results below: foo/models.py = from django.db import models class Person(models.Model): name = models.CharField(max_length=42)

Re: Getting into professional django development

2011-10-18 Thread Tim Chase
On 10/18/11 08:46, Dan Gentry wrote: With all due respect to Mr. Gonsalves, I do not care to work with the Django trunk unless I'm just playing around with something. My goal is always to produce a production quality application. Even the more stable than average Django trunk cannot provide the

Using .filter() on a constant expression

2011-10-15 Thread Tim Chase
I have some gnarly AND/OR logic combining Q() objects but deep within the logic, I need to do a comparison of two constants. In an ideal world, the logic would look something like def age(self, age): ... & Q(12=as_of.month) & ... but that's invalid python. I *can* break out this rats

Re: Return a CSV and a template in the same response.

2011-10-03 Thread Tim Chase
On 10/03/11 17:53, Jack wrote: Hey gang, I am trying to use a response object to serve a dynamically created CSV. I have that part working perfectly but I'd like to display a page afterwards with a summary of the data. Is there a good way to do this? I tired added the rendered template to the htt

Getting testing to report multiple tests per-assertion vs. per test-method

2011-09-28 Thread Tim Chase
Is there an easy way to get Django's test framework to report on the number of assertions performed instead of the number of test-methods called? I have things like def test_date_fenceposts(self): date_result_tuples_to_test = ( (date(2011,4,1), 35), ... #however many test

Creating a custom Model Field accessing multiple DB fields

2011-09-23 Thread Tim Chase
Having read through [1] and experimented with it a bit, I've been unable to determine whether my failure is due to a Django limitation or if it's my own fault. My question comes in two parts: 1) Can a custom model-field interface with more than one DB field? The .db_type() method's return-si

Removing SECRET_KEY from settings.py

2011-09-16 Thread Tim Chase
Just returning to some Django work after a time away, I (re)started an old project in 1.3 and hit an early issue. I'd like to keep my settings.py under revision-control that is somewhat publicly accessible, but don't want my SECRET_KEY exposed. The solution I've opted for is the following exc

Re: Django template : For Loop

2010-09-06 Thread Tim Chase
but is this correct way to get values from two tables and use in templates? Me actually want to combine to tables and use there values in template Is the above post code is correct way to do this? Combine the in the *view* with the zip() built-in, and use Steve's suggestion to split the part

Re: LIMITATIONS of django

2010-09-04 Thread Tim Chase
On 09/04/10 11:45, samie wrote: sir what are the shortcomings and limitations of Django. i am newbie and got to develop my own cms using python. Some of the limitations I know of: - composite keys (long-range plans; alternatively, nothing prevents you from using SQLAlchemy or the like) - su

Re: potential issue re in memory django file uploading.

2010-08-30 Thread Tim Chase
On 08/30/10 10:09, dave b wrote: well you finish the tutorial(s) now and then you try to upload a file right? So you start uploading the file. Now because (I assume you are still using the django built in webserver) why don't you play with this a bit, start uploading say 10 1gb files(all at once)

Auto-generating menus based on walking urls.py?

2010-08-27 Thread Tim Chase
Just playing around with some ideas, I've been trying to figure out how to auto-generate some menus based on my url.py config layout. 1) what's the preferred way to get the "base" (rather than include()'ed) urls.py I see a core.urlresolvers.get_urlconf but that seems an internal piece of mach

Re: double for in the template

2010-08-26 Thread Tim Chase
On 08/26/10 11:10, Andrea Imparato wrote: How can i scan the zipped list in the template page? If I do {% for f in zip %} {{ f }} {% endfor %} How can I access the second item in the index? I think since version 1.0, you can just use standard tuple-unpacking syntax as detailed in the help[1]

Re: double for in the template

2010-08-26 Thread Tim Chase
On 08/26/10 10:17, Andrea Imparato wrote: I have 2 lists and I have to scan them "concurrently" with the same indexes at the same time. Something like: {% for lists %} first item from the first list first item from the second list {% endfor %} I thought about creating something like a map with

Re: do QuerySet joins still suck?

2010-08-10 Thread Tim Chase
On 08/10/10 18:39, Phlip wrote: The point of a relational database is to distribute everything into normalized tables, then perform set operations on multiple tables. Given an Order model with many order_items, other ORMs allow me to query them like this (in a hypothetical notation): Order.obje

Re: Best way to find near people

2010-07-29 Thread Tim Chase
On 07/29/10 16:58, Alexandre González wrote: Hi! I'm searching near people in my app. I'm doing it a this way: 37 people = Person.objects.all().exclude(user=request.user) 38 39 near_people = list() 40 for person in people: 41 if self.is_near(m

Re: single point of entry to a webpage

2010-07-27 Thread Tim Chase
On 07/27/10 03:08, bruno desthuilliers wrote: A django *project* is composed of * one or more apps. * templates * static resources (css, images etc) ...and one or more "utils.py" files... :-) (tips his hat in the direction of JKM and makes a hasty exit...) -tkc -- You received this mess

Re: scaling my site

2010-07-24 Thread Tim Chase
On 07/24/10 09:12, tiemonster wrote: First off, what type of application is it? Many reads, many writes, or both? If you have lots of reads and few writes (like a blog or PR site), you can do heavy caching and you'd be fine with just about any host. If you have lots of writes (like a forum or com

Re: working with model fields

2010-07-24 Thread Tim Chase
On 07/24/10 03:47, shwetanka wrote: On Jul 24, 12:39 pm, Masklinn wrote: hey guys, im making a form, and im having a problem with the models.TextField() , when used it displays the text field correctly, but it allows for the text field to be stretched, is there a way to set a maximun width and

Re: URL didn't match

2010-07-16 Thread Tim Chase
On 07/16/2010 04:26 PM, Duncan wrote: Request URL: http://[redacted]/seeds/ ... 1. ^seeds/ ^/$ ... urlpatterns = patterns('', (r'^seeds/', include('seeds.general.urls')), While you don't include seeds.general.urls in your post, given the traceback you kindly included, it looks lik

Re: Error related to googlebot?

2010-07-12 Thread Tim Chase
On 07/12/2010 01:10 PM, Tor Nordam wrote: So my question is if there is anything in particular which might cause the page to crash when a searchbot tries to load it, but not do the same for a regular user. Well, additional information about the HTTP transaction might help. Bots may or may not

Re: www.djangoproject.com

2010-07-01 Thread Tim Chase
On 07/01/2010 02:37 PM, FC wrote: I already used Wireshark to see what's going on with the unique combination "Firefox under Lucid Lynx accessing djangoproject.com": the djangoproject.com host simply doesn't respond to the initial HTTP GET request (or the reply never gets through). Not sure what

Re: Proper approach to updating model object with 100 attributes.

2010-06-30 Thread Tim Chase
I'd stick to setattr and maybe verify that the key in the dictionary is one of the model's fields. I think there is a method on _meta called get_all_field_names. I've used this before to validate such actions. If that's the case, you can tweak the above to something like for name in obj._me

Re: Proper approach to updating model object with 100 attributes.

2010-06-30 Thread Tim Chase
On 06/30/2010 02:10 AM, euan.godd...@googlemail.com wrote: I think you need to be careful messing with __dict__ as Django turns most fields in descriptors behind the scenes so setting them in the __dict__ could break these. Yeah, that was somewhat my assumption (and thus my caveat). Well, you

Re: Proper approach to updating model object with 100 attributes.

2010-06-29 Thread Tim Chase
On 06/29/2010 12:01 PM, Ray Cote wrote: Hi List: I have a Django model with over 100 fields in it that is loaded from a data feed. Each row in the model has a unique field, let's call it item_id. When loading new data, I'm first checking to see if item_id is in the table, if it is, I want to up

Re: Twitter API

2009-12-27 Thread Tim Chase
> Is there a Twitter API that would allow me to update a Twitt via > Django? If so would you be kind enough to send me the link? I've used Twyt[1] for both command-line posting and for API usage. It's all pure python and AFAIK doesn't have any dependencies outside of stock python. Also, (near

Re: how can i find out that Development server is running or not?

2009-12-07 Thread Tim Chase
> how can i find out that my project ran under apache or development server ? Though not 100% foolproof, I usually use from sys import argv if 'runserver' in argv: do_development_server_stuff() else: do_non_development_server_stuff() -tim -- You received this message becau

Re: Unexpected OSError when deleting an image

2009-11-26 Thread Tim Chase
> When I try to delete an image (specifically I'm deleting an instance > of a photo model that contains an imagefield) I get an OSError, > "[Errno 1] Operation not permitted" > > The first thing I tried was checking the permissions in Ubuntu, > they're set to allow write access for everyone. > >

Re: applying a patch

2009-11-26 Thread Tim Chase
rebus_ wrote: >> diff --git a/django/contrib/admin/media/js/admin/ >> RelatedObjectLookups.js b/django/contrib/admin/media/js/admin/ >> RelatedObjectLookups.js >> index 1bc78f8..3941752 100644 >> --- a/django/contrib/admin/media/js/admin/RelatedObjectLookups.js >> +++ b/django/contrib/admin/media/j

Re: how to symlink to django-admin.py from some place on path?????.

2009-11-23 Thread Tim Chase
> I'm tryin to install django on my windows machine, but I got stuck in > the followin line "Consider symlinking to django-admin.py from some > place on your path, such as /usr/local/bin." I'm not too techno- > savvy...can someone point me in the right direction as to what that > means and/or how

Re: Template variables and tags confusion... (regarding concatenation)

2009-11-21 Thread Tim Chase
> When I do in a template I get id="item_1"> in the rendered html as expected. > > Now I want to do {% cycle '' ' class="odd" id="item_{{ product.id }}">' %}, but the desired > concatenation does not happen. > > How do I achieve what I want? sounds like you want something like -tim

Re: digg style pagination

2009-11-19 Thread Tim Chase
> But getting an exception. Could you help to fix it please? > > TemplateSyntaxError at /section/home > > Caught an exception while rendering: 'request' > > Original Traceback (most recent call last): > File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", > line 71, in rende

Re: TemplateSyntaxError

2009-11-10 Thread Tim Chase
> (I changed "Education" to "School" because in the admin panel it > showed up as "Educations". I think "Schools" makes more sense.) Did you remember to syncdb afterwards? I'd be interested to see if the SQL you showed is what the tables in the DB actually look like. > Any ideas why Lawyer li

Re: How to handle this race condition?

2009-11-10 Thread Tim Chase
>> 1) retrieve the current_high_bid field of the Auction object >> 2) compare it with the new_bid >> 3) if the new bid is higher than current_high_bid, I update >> current_high_bid to the value of the new_bid. >> >> but there's a (slight) chance that between steps (1) and (3) a >> different user c

Re: Display a value from another table

2009-11-02 Thread Tim Chase
> class Author(models.Model): > name = models.CharField(max_length=100) > title = models.CharField(max_length=3, choices=TITLE_CHOICES) > birth_date = models.DateField(blank=True, null=True) > > def __unicode__(self): > return self.name > > class Book(models.Model): >

Re: Versionable Models?

2009-10-27 Thread Tim Chase
> There's quite a learning curve here. The learning curve doesn't have much to do with Django, but rather development in general -- any time you take on a new technology (or soup of technologies, in this case Python/HTML/CSS Django's templating language, and possibly SQL) there's a hill to cl

Re: Do reverse relations eventually kill performance?

2009-10-25 Thread Tim Chase
Gerard wrote: > Hi all, > > I'm working on a safe way to get users to only see there own records. I've > been working on subclassing model.Manager and requiring a 'owner' parm for > filter() or otherwise returning an emtpy query set .. just to failsafe my > own view coding. > > Then I figured

Re: SVG and Django

2009-10-16 Thread Tim Chase
> > > > >type="image/svg+xml" > pluginspage="http://www.adobe.com/svg/viewer/install/"; > /> > > > > > This file works fine when I opened it with firefox, but dont work if > the file is served by django server. The SVG imag

Re: Embedding multiple images in html email

2009-10-15 Thread Tim Chase
> Can't you include the link and source within the html code of the email? The problem then becomes that many email programs no longer display remote images inline unless the email comes from a trusted source. It was a popular way to add tracking bugs to HTML emails, so MUAs began to disable

Re: directory name with space

2009-10-13 Thread Tim Chase
Михаил Лукин wrote: > Well, I don't know what is under scarico/(\d+)/ - single file or a directory > tree. > > In case of directory tree ".+" seems to be the best way, which is also > documented at > http://docs.djangoproject.com/en/dev/howto/static-files/ > > In case of single file "[^/]+" inst

Re: directory name with space

2009-10-13 Thread Tim Chase
>> Hello i have a small application where in the urls i have >> this : >> >> (r'^scarico/(\d+)/(\w+)/$', >> 'sitonorme.gestnorme.views.scarico'), >> >> the problem is that in the \w+ sometimes i have name with >> space li dir one that i can't rename. > > Maybe you should try smth like this: > >

Re: Running just core regression tests

2009-10-12 Thread Tim Chase
>> On my oldest slowest machine (7 year old WinXP box with 384M of memory), >> Then you're not far off -- my home work-horse is an 8-year-old >> Celeron laptop clocked at 800MHz with 384M of memory running >> Debian off a fairly slow HDD. > > My 800MHz Celeron laptop got retired about a year ago

Re: Current Django tests fail?

2009-10-12 Thread Tim Chase
> I just ran the full suite usine SQLite on r11603, and got 100% pass on > 917 tests. > > I can't think of an obvious cause, but the fact that you're getting > errors in runtests.py is mighty suspicious. The fact that you've got > 50 less tests than you should is also suspicious. > > My first gu

Current Django tests fail?

2009-10-12 Thread Tim Chase
Got the following while testing latest trunk and haven't touched this file (runtests.py). t...@rubbish:~/code/django/trunk/tests$ python runtests.py --settings=settings == ERROR: runTest (__main__.InvalidModelTestCase)

Re: Running just core regression tests

2009-10-11 Thread Tim Chase
>> t...@rubbish:~/django/trunk/tests$ python runtests.py >> --settings=settings >> >> to execute the core set of tests. However, it takes quite a >> while (on the order of hours) on my old box. Is there a way to >> just run tests on the regressions/ subdirectory or even just a >> particular file

Running just core regression tests

2009-10-10 Thread Tim Chase
Currently, I use t...@rubbish:~/django/trunk/tests$ python runtests.py --settings=settings to execute the core set of tests. However, it takes quite a while (on the order of hours) on my old box. Is there a way to just run tests on the regressions/ subdirectory or even just a particular fi

Re: Show first available Image in a loop

2009-10-09 Thread Tim Chase
> I'm looping through an array of 'trading card' titles. For instance: > > - Pokemon > - Kiss > - Baseball > > Instead of showing just the title of the 'trading card', I'd like to > display an image of each instead. > But not all images are available for every card in a title, for > instance

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Tim Chase
> I only want to keep 6 months worth of data. How can I > efficiently delete a month and all it's associated > 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) I woul

Re: Q regex

2009-10-06 Thread Tim Chase
Karen Tracey wrote: > On Tue, Oct 6, 2009 at 1:32 PM, Mat wrote: > >> Okay so here is my code: >> >> **This way works and does not error** >> rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); >> print len(rs); >> print rs[0].addr >> >> ***This way errors

Re: Confirmation dialog on deleting...

2009-10-02 Thread Tim Chase
> I search over the net, but I don't find how can do this. I > need to pop up a dialog with: "Are you sure to delete this?" > every time when I want to delete a row from a list, etc. Can > you tell me where I found an exemple or some documentation, or > how to pop up a dialog box in Django. The t

Re: database design

2009-09-30 Thread Tim Chase
> products_ordered = models.ManyToManyField(Product) > > i don't like it (as i would have to create my own "through" table/ > class) > for saving the recent price, qty, date etc. I'm not sure what your complaint about the "through" table is -- is it that you'd have to create it (which you do be

Re: Named URL Patterns -- Syntax Error

2009-09-25 Thread Tim Chase
> Can somebody tell me why i get a syntax error with this named URL > pattern? > > urlpatterns = patterns('', > url(r'^feed/(?P.*)/$', > 'django.contrib.syndication.views.feed', > {'feed_dict': feeds} looks like a missing comma here... > name="feed"), > ) -tim --~--~---

Re: HttpResponseRedirect(request.META["HTTP_REFERER"])

2009-09-24 Thread Tim Chase
dijxtra wrote: > Is it safe to use HttpResponseRedirect(request.META["HTTP_REFERER"])? > Can a session be stolen using this coed by spoofing HTTP_REFERER? Two things stand out to me: 1) HTTP_REFERER is not a required header, so if the browser doesn't send it, your code won't do what you expect.

Re: Could Django handle this particular setup?

2009-09-23 Thread Tim Chase
> So to sum it up, 1 admin area, 1 member database (under 1 domain) [snip] > Would something like this be possible in Django? The problem is I'm > not sure what should be a separate App or Project... the goal is to be > able to deploy new "front-end" quickly...so perhaps this could be a > separate

Re: Pseudo random order for Paginator

2009-09-23 Thread Tim Chase
> thx, take a random seed form the session and shuffle data is a good > idea > > looks like slow because of amount od data, but I can save the random > numbers for each row in the database and make 2 selects, one > then > random(seed) and join it with the other, <= random(seed) The catch is if t

Re: Pseudo random order for Paginator

2009-09-22 Thread Tim Chase
> I need ordering units in random order, but keep the order for browsing > per pages and also keep the order for changeable filtering options, > like startswith and contains. What are the best solutions? There is > huge amount of units and I read the order by RANDOM() or especialy > MySQL RAND() i

Re: queryset union

2009-09-17 Thread Tim Chase
> Then you'll need to use SQL. There's no way to do UNION in Django's > ORM. > > An alternative is just to concatenate the two querysets: > union = list(x) + list(y) Or if the results are large and you don't want to consume double the memory, you can use itertools.chain() from itertools imp

Re: SyntaxError: unexpected character after line continuation character

2009-09-14 Thread Tim Chase
> File "C:\djproj\mysite\..\mysite\views.py", line 1 > > {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss > \fcharset0 Arial;}} > > ^ > SyntaxError: unexpected character after line continuation character Looks like your views.py file was saved in RTF format instead of plain

Re: How to server static media secured by Django authentication

2009-09-11 Thread Tim Chase
> I have a requirement to serve static files only to users authenticated > through Django secure login. You may be interested in: http://code.djangoproject.com/ticket/2131 Both mod_python and mod_wsgi support the ability to return a header that instructs the web-server to "dump this local file

Re: Authenticate against FDS

2009-09-08 Thread Tim Chase
> How to autenticate against Fedora Directory Server? I believe FDS is simply Red Hat's LDAP server. If you google "django ldap" there are a number of good resources on using LDAP for Django authentication. -tim --~--~-~--~~~---~--~~ You received this messa

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

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

<    1   2   3   4   5   6   7   >