http://alt.coxnewsweb.com/statesman/img/photos/3699112.jpg

2008-10-17 Thread Norman Harman
is there Sorry for the screw up -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman ___ Get off the sidelines and huddle up with the Statesman all season long for complete high school, college and pro

Re: actual django stack

2008-09-25 Thread Norman Harman
Frédéric Sidler wrote: > What it the best Django stack today. > > In django doc, it says that apache with mod_python is the best > solution in production. But in the same time I see that everyblock use > nginx (probably in mode fastcgi). > > Did you some of you test different solution and can

Re: Querying Users with Permission

2008-09-25 Thread Norman Harman
bobbyc881 wrote: > I'm generating a list of Users in a specific group, in this case, > "Artists", for a form: > > artist_group = Group.objects.get(name="Artists") > artist = > forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group), > required=False) > > I'd like to re-write

Re: strategy for deploying to production server

2008-09-23 Thread Norman Harman
sotirac wrote: > Just trying to get a feel for what other developers are doing when > deploying to a production server. There are some differences between > my development machine and production server such as the location of > my media files, the database settings, and if I want to enable

Re: function import errors model import in other file

2008-09-22 Thread Norman Harman
Gerard Petersen wrote: > Hi All, > > I'm trying to import a function. When adding this statement I get a Model > import error in a completely different place, not even related. I've added > the files from my app directory and their import statements below. > > Are there any unauthorized

Re: Querysets and includes

2008-09-22 Thread Norman Harman
Charles Choiniere wrote: > On Mon, Sep 22, 2008 at 10:46 AM, Norman Harman <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > nek4life wrote: > > How would I go about getting a queryset into an include? Say I > have a > >

Re: Querysets and includes

2008-09-22 Thread Norman Harman
nek4life wrote: > How would I go about getting a queryset into an include? Say I have a > blog and I have a page for the post detail. On the sidebar I would > like to have the blog categories dynamically built or have recent > articles, or recent comments, etc... What would be the best

Re: resolving urls template error

2008-09-18 Thread Norman Harman
Sven Richter wrote: > when i try to call: > {% url profile_myiq argument %} > NoReverseMatch: Reverse for 'youriq.profile_myiq' with arguments '('',)' and > keyword arguments '{}' not found. > (r'^(?P\w+)/$', 'user', {} 'profile_myiq'), The error indicates you were providing either empty

Re: Two Django visions running at once.

2008-09-17 Thread Norman Harman
KillaBee wrote: > Is it possible to have two versions of django running at the same time > on an Ubuntu server(9.0 and 1.0)? Yes, depending on your definition of "running". Far too much depends on how you've set things up and what exactly you want to accomplish to give advice. Esp based on

Re: Can not under stand the error obtained when validating a model.py

2008-09-17 Thread Norman Harman
Karthik Krishnan wrote: > The stack trace is given below > > Traceback (most recent call last): > File "manage.py", line 11, in > execute_manager(settings) > File "c:\tools\Python25\Lib\site-packages\django\core\management > \__init__.py", > line 340, in execute_manager >

Re: Reusable views from a template - How?

2008-09-17 Thread Norman Harman
WillF wrote: > > > > David Durham, Jr. wrote: >> >> On Wed, Sep 17, 2008 at 1:35 PM, WillF <[EMAIL PROTECTED]> wrote: >>> I have written a login view as I have followed the tutorial but how do I >>> reuse this view in multiple pages of the site? >>> >>> Is there a way to render this particular

Re: Problem with named paths

2008-09-17 Thread Norman Harman
Brandon Taylor wrote: > Hello everyone, > > I'm using named paths as such: > > url(r'^[-\w]+/(?P[-\w]+)/$', 'render_page', > name='nested_page_link'), > url(r'^(?P[-\w]+)/$', 'render_page', name='page_link'), > > The only difference between these two urls is that some pages in this > site can

Re: Accessing field names and data from a queryset in a generic template

2008-09-12 Thread Norman Harman
SnappyDjangoUser wrote: > I am a new django user so please excuse my naive question. > > I have a generic view function (see below) which is used to perform a > query on one of many tables (depending on the "model" argument) and > then render the results to a single template file

Re: How to prevent URL HTML encoding?

2008-09-12 Thread Norman Harman
Ross wrote: > I setup a URL that accepts any number of characters and the '+' > symbol, which works just fine. > > /search/pets/dog+cat > /search/pets/turtle > /search/pets/turtle+cat+mouse > > All of those URLs go to the same view. The view splits the third > argument on the '+' symbol and

Re: Apache httpd conf with mod_python

2008-09-08 Thread Norman Harman
[EMAIL PROTECTED] wrote: > Setting our Apache server at work, got everything installed. In the > httpd.conf there's quite a bit of content, do I need that content, or > should I just replace it with what I need for Django? You probably don't need all of it. But I doubt anything will work if

Re: Building ORM relations without saving...

2008-08-29 Thread Norman Harman
Koen Bok wrote: > I'd like to build object relations (Model classes) without saving them > to the database to predict a price for a specific order. Let's say I > have this: > > class Order(Model): > id = models.AutoField(primary_key=True) > number = models.IntegerField() > >

Re: Modules path when importing models

2008-08-25 Thread Norman Harman
Alexis Bellido wrote: > I'm reading the Django book and playing with the 'mysite' test site, > in many parts I've noticed something like this in views.py: > > from mysite.models import Event, BlogEntry > > I was wondering if it's good practice using 'mysite.models' (which > seems to be an

Re: Calling attributes from other models

2008-08-25 Thread Norman Harman
Matt Berg wrote: > I apologize, I realize this is probably documented somewhere. > > Say I have 2 models. > > Artist and Album > > Album has a foreign key to Artist. > > I want to do a list_display of Albums something like this... > > list_display =

Re: custom widget necessary?

2008-08-25 Thread Norman Harman
peter_g wrote: > Hi! > > I have datetime fields like "createdate" or "modified" in some of my > models. > Do I need to create custom widgets if i want their time and date to > be displayed in the admin area (change-form) and not the default > editable representation (text fields, with "now" etc.

Re: Help needed: too complex for me

2008-08-21 Thread Norman Harman
space0x42 wrote: > Hi all hi, I bet your getting an error since the labels property has no "setter" only a getter and you are trying to assign to it. I'd probably try to rewrite the models with proper model fields instead of that label. But, might not be an option nor good option for someone

Re: Init Parameter Trouble

2008-08-21 Thread Norman Harman
Robert wrote: > Hello all, Can we see your view code please? -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman ___ It's August! Keep your cool with the Statesman. Check out our hot deals in print

Re: Reverse URL Questions

2008-08-21 Thread Norman Harman
On Thu, Aug 21, 2008 at 1:50 AM, Rodney Topor <[EMAIL PROTECTED]> wrote: > Second: Doesn't the use of get_absolute_url() somehow violate the > separation of URLs from models? I think so. I have found named urls http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns url

Re: Renaming of mailing lists to avoid user confusion

2008-08-20 Thread Norman Harman
Malcolm Tredinnick wrote: > Because over the last three years, this group has done an *excellent* > job at providing help and support. And, yes, I have the credibility to > make that claim: I have never posted a request for support on this list > and have posted the most number of mails to the

Re: Redirecting to different page depending on user authentication

2008-08-20 Thread Norman Harman
ad777 wrote: > Hi there, > > I am new at django and I was wondering what is the best way of > redirecting users to their own customized page after they get > authenticated. I have extended the user model to include a unique > user id for each user... is it somehow possible to use this? The

Re: django deploymennts

2008-08-19 Thread Norman Harman
Robin wrote: > Hello, > > I am trying to decide which tool should I use to deploy my django > based application, and I have some candidates and want to know what > are your opinion about this. My deployments will be in more than one > server. > > First I though about Capistrano, but I don't

Re: Trouble with regex

2008-08-18 Thread Norman Harman
Fernando Rodríguez wrote: > Hi, > > I have the following regexes on my django app urls.py: > > urlpatterns = patterns('', > ># List of all resumes for a given Career >(r'(?P[-\w]+)/$', career_list), >

Re: Heavy database query (max 32 tables problem)

2008-07-18 Thread Norman Harman
Deniz Dogan wrote: > Hey. > > I have a model Course and then I have django.contrib.auth.models.User. > Users and courses are related through M2M, so a user can register for > many courses and a course can register multiple users. Now, given a > potentially very long list of users, I want to

Re: keeping a list of objects sorted

2008-07-17 Thread Norman Harman
jelle wrote: > Hi Norman, > > Yep, I'm just looping through the list. > Pretty awkward, right? Yes, very. Is the html output order seemingly random? or is there some pattern to it? Cn you post the code for the view? I'm guessing there is a typo or something similar going unnoticed. --

Re: keeping a list of objects sorted

2008-07-17 Thread Norman Harman
jelle wrote: > Hi, > > I'm using the tagging app to construct a view where the most recent > articles by tag are shown, ordered by date. > To do so I use the following code: > > all_tags = set([i.name for i in Tag.objects.all()]) > articles = [] > for i in all_tags: > qs =

Re: Why 2 servers to serve dynamic and static content?

2008-07-17 Thread Norman Harman
eka wrote: > Hi, > > I'm new to django, and reading around, found out that it's better to > have 2 different web servers for django and static content. How is so? It's scalability issue. Each process of a server setup to serve dynamic content (using mod_python for instance) typically uses

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

2008-07-16 Thread Norman Harman
Hani wrote: > Hi, > > I'm a newbie and am having a an issue accessing the attribute for a > variable. I did a search (django documentation and here) and found > nothing. If this has been covered before, please direct me to the > correct thread. > > I currently pass a context to my template and

Re: ImageFiled Uploads

2008-07-16 Thread Norman Harman
Dane Hesseldahl wrote: > How do I get to the image when the avatar field has an image uploaded > through it? http://www.djangoproject.com/documentation/upload_handling/ -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman

Re: How to deal with two distinct UserProfile model ?

2008-07-16 Thread Norman Harman
Hades_L wrote: > Hello, > I'm having trouble dealing with User module. In my application, I have > two types of users who should be able to log in. > The first one is an Employee, so I have a code like this: > class Employee(models.Model): >someFields = ... >... >user =

Re: How do I know, in a unit test, the user authenticated after login?

2008-07-16 Thread Norman Harman
Florencio Cano wrote: > Hi, > I would like to know how I can retrieve the user id of the user > authenticated in the auth subsystem after login in a test. > > class CrearCarteraTestCase(TestCase): > fixtures = ['/fixtures/initial_data.xml'] > > def setUp(self): >

Re: urllib https post and parsing question

2008-07-11 Thread Norman Harman
Bobby Roberts wrote: > Hi group. I'm using urllib to send information to my payment > processor via https as follows: > > [snip] > import urllib > > [snip] > > DataPacket = urllib.urlopen(PostUrl , DatatoSend) > PayResponse = DataPacket.read() > PayResponse.close() > > PostUrl is the url i'm

Re: Alpha Chars in dynamic url?

2008-07-10 Thread Norman Harman
lukeqsee wrote: > Thanks, it worked. > > On Jul 10, 1:48 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote: >> Luke, this should work. Here's an example I use: >> >> *urls.py:* >> url('^user/(?P\w+)/$', user.view) Not sure what you meant by "alpha chars" but \w+ matches more than just [A-Za-z]+

Re: Accessing SQL result by column name

2008-07-10 Thread Norman Harman
Michael Burton wrote: > For example, > > cursor = connection.cursor() > > cursor.execute('select a, b, c from foo') > > rows = cursor.fetchall() > > print rows['a'] > Is there a db-independent way (or any way at all for users of postres) > to use column names in SQL queries

Re: Named URL not picking up parameter value

2008-07-09 Thread Norman Harman
Brandon Taylor wrote: > url(r'^(?P[w-]+)/$', 'my_site.groups.views.show_group', That regex matches one or more w's and hyphens. You surely wanted [-\w] to match letters, numbers, underscores and hyphens. -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman

Re: how to post XML with python / Django

2008-07-09 Thread Norman Harman
Bobby Roberts wrote: > We are using a payment gateway for usaepay.com to process credit > cards. Does anyone have experience with this? I'm trying to find a > good resource for posting XML to another site but i'm coming up short > with how to do this in django and python. Create a

Re: Problem with broken link emails

2008-07-09 Thread Norman Harman
HenrikG wrote: > Hi! > > I have a problem with email-reports of "Broken INTERNAL link" that > doesn't seem correct. For example this one: > > Referrer: http://www.teamxstream.se/ > Requested URL: /star_empty.gif > > When I access the referrer page, I get no error message myself and in > the

Re: memcached

2008-07-09 Thread Norman Harman
gt7658b wrote: > Hello, I tried to use memcached as follow. BTW, memcached is running > as seen from top command on server. > > CACHE_BACKEND = 'memcached://127.0.0.1:11211/' > # CACHE_BACKEND = 'dummy:///' > CACHE_MIDDLEWARE_SECONDS = 60*30 > CACHE_MIDDLEWARE_KEY_PREFIX ='' >

Re: does django cache models.py?

2008-07-09 Thread Norman Harman
Daehee wrote: > i'm trying it figure out why django is not recognizing a new models.py > file for my app. even when i completely butcher the code in models.py > or change the filename and run "manage.py sqlreset" or "manage.py > syndb," it still generates the old model. any thoughts?? manage.py

Re: Trying to understand project structure w/apps

2008-07-08 Thread Norman Harman
eddie wrote: > Hi guys+gals, > > I'm new to django, and I'm trying to wrap my head around a project > structure. I have a simple case that I'm thinking about, but can't > put together a reasonable mental model for it. > > I've got a site that has a schedule component (events), and a news >

Re: Markup languages vs HTML

2008-07-08 Thread Norman Harman
Matic Žgur wrote: > Hi, > > I'm working on some project, a part of which is a small blog app. All > the blog posts are saved as HTML (using TinyMCE in admin). I was > wondering, after reading some stuff about Markdown, what are pros and > cons of each method, ie. saving posts with some markup

Re: How to create field not stored in database, but visible in admin?

2008-07-08 Thread Norman Harman
Marek Stępniowski wrote: > How to create a field that is not stored in database, but is visible > in Django newforms-admin? (I'm assuming there is a way) > > I would like to define a field which acts as a kind of proxy. Setting > and getting value of this field actually runs some defined

Re: What's the best way to simulate a request?

2008-07-08 Thread Norman Harman
Andrew wrote: > Here's the situation: > > I'm creating an RESTful internal API as an app in our project. Our > 'main' app (we'll call it main) is a client of the API app. Since > we're building the API piece by piece as we use it, the emphasis on > all of this is simple simple simple -- with our

Re: Usability: stripping white space from form fields

2008-07-07 Thread Norman Harman
Karen Tracey wrote: > On Fri, Jul 4, 2008 at 3:51 AM, Greg Fuller <[EMAIL PROTECTED] > > wrote: > > I want to mention what I consider to be a usability issue with Django > forms. It has to do with there being no option to strip leading and > trailing

Re: removing page from cache (memcache)

2008-07-03 Thread Norman Harman
Mike Chambers wrote: > I just did some local debugging, and notice something interesting. The > cache key appears to be generated based on a hash of the request headers. > > This means that visiting the same page in two different browsers will > generate 2 unique keys, which means that the

Re: raise Http404("my message")

2008-07-03 Thread Norman Harman
Aljosa Mohorovic wrote: > if i call raise Http404("my message") and i set custom view to handle > 404 errors how do i get "my message" in that view? I was gonna say look at the default 404 template. But, in my django (newforms admin branch) /django/contrib/admin/templates/admin/404.html there

Re: assertRedirects do not exist in 0.97 pre?

2008-07-03 Thread Norman Harman
Florencio Cano wrote: > Where is the problem? where you don't use django's TestCase > import unittest > class UserTestCase(unittest.TestCase): from django.test import TestCase class UserTestCase(TestCase): -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman

Re: testing login problem

2008-07-02 Thread Norman Harman
laspal wrote: > Hi, > I have created initial_data.xml using dumpdata and > """manage.py loaddata initial_data.xml""" gives me no error. > but still I am not able to login using setUp().. and this is > essential as all my views functions required login.. > > here is my test file: > > import

Re: django+mod_python, caching or something else?

2008-07-02 Thread Norman Harman
Alex Koshelev wrote: > Or may be a custom template tag for common stuff. Or like any code anywhere just extract the common parts to a helper function and call that. -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman

Re: Inheriting from auth.models.User

2008-06-30 Thread Norman Harman
Ayaz Ahmed Khan wrote: > bhunter wrote: >> This should be a simple question. I'd like an Employee model. First >> name, last name, username, password--basically all the same stuff >> that's already in django.contrib.auth.models.User. Maybe I want some >> other things like salary, too. So, it

Re: Stability of trunk and 1.0 target: experience, testimonials?

2008-06-27 Thread Norman Harman
I've been using trunk for over 9mo for in production website http://storymash.com During that time, there's been 2-3 times my unittests have failed after I've svn updated django. Each time was a fairly quick fix. API changes aren't hard bugs to track down and fix. The advantages of all the

Re: views.py: Always a simple return?

2008-06-26 Thread Norman Harman
RossGK wrote: > > Stuff I think you don't want HTTP. In other words you are wanting (like the Comet folks) HTTP to do things it was not designed to do. In other words you are avoiding its strengths and chasing after its weaknesses. Not sure what your real requirement is but, Look at the

Re: Unit test problem

2008-06-26 Thread Norman Harman
Malcolm Tredinnick wrote: > Status code 302 is an HTTP redirect, which is what you would expect to > see, since your view is always returning a HttpResponseRedirect. The > test framework doesn't follow redirects. What about? assertRedirects(response, expected_url, status_code=302,

Re: Django inserts an empty string into IntegerField?

2008-06-25 Thread Norman Harman
Huuuze wrote: > Thanks for getting back to me. You're correct -- that article is not > a one-for-one match when compared to my problem, so let me tweak my > question. > > When I attempt to save (my_form.save()) and I leave the zip code field > blank, I receive the following exception: > >

Re: Django inserts an empty string into IntegerField?

2008-06-25 Thread Norman Harman
Huuuze wrote: > I have defined a zip code field as follows in my Address model: > > zip = models.IntegerField(blank=True, null=True) > > Being a good Djangonaut, I'm using a ModelForm to convert my address > model into HTML. Now this where things get dicey. As you can see in > the model, zip

Re: global variable issue

2008-06-24 Thread Norman Harman
[EMAIL PROTECTED] wrote: > If I hit Ctrl-R again it puts my name back, and so on. It's like there > there are two copies of the global that I am accessing. I can't figure > this out. Any ideas? Thanks so much! Rule 1: Don't use globals. Rule 2: Don't try to store state in a stateless server,

Re: Deciding where I am in the template hierarchy

2008-06-24 Thread Norman Harman
3xM wrote: > Inside a template, is there a way to decide whether it has any parent > template(s) or it is the root template? > > I've got some templates including each other, but also want to be able > to view them individually. But i still want the root template to > extend my base template. >

Re: Struggling with Django/legacy data

2008-06-23 Thread Norman Harman
skins96 wrote: > Hi, > > I'm a noob who is struggling with understanding how Django might work > with legacy data. > > It seems Django's foreign keys rely on having an integer in both the > parent and child table. However, we get a lot of data where what's > needed is a join based on

Re: How best to delete one of multiple records?

2008-06-23 Thread Norman Harman
Kenneth McDonald wrote: > I have a list of records, and I'd like the user to be able to delete > any given record by pressing a button. My current strategy is to have > each record in its own form (so that pressing the submit button for > that form would delete the record), and have each

Re: Where to install additional libraries?

2008-06-23 Thread Norman Harman
Jamie Pittock wrote: > Thank you Gordon (and Joshua) that's really useful. > > I think I'll use the site-packages folder then. After doing what you > said I've noticed I seem to have multiple installs of Python on my > machine (OSX). > > /usr/lib/python2.5/ > /Library/Python/2.5/ >

Re: custom form with admin look and feel

2008-06-23 Thread Norman Harman
chefsmart wrote: > I'm using django svn trunk. I have created several custom forms that > show up in the admin section of the website. However, these forms look > nothing like the admin forms. I tried extending change_form.html > template - unsuccessfully. > > Does anyone know what my template

Re: Automatic Update of template

2008-06-20 Thread Norman Harman
[EMAIL PROTECTED] wrote: > Hi, > > I am writing a web based chat client in Django framework. When ever I > receive a message, I get that in a python function which is in the > same file as my views. Can I directly pass this data to the template > (by using response_to_render ) to update the

Re: Thanks!!!!!!!!!!!!!!!!!

2008-06-20 Thread Norman Harman
Django just rocks, thanks. It has, taught me some advanced Python made me money on consulting gigs allowed storymash.com's owner's vision rapidly come to life got me working and actually making progress on a couple personal projects helped me land full-time position primarily

new forms admin is there an equiv to unique_for_date

2008-06-19 Thread Norman Harman
This is what I'm talking about http://www.djangoproject.com/documentation/model-api/#unique-for-date Searching internets can not find any answer. Thanks, -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman

Re: Quick way to find list objects close to the current date?

2008-06-19 Thread Norman Harman
mw wrote: > Hello, > > > I was thinking about ways to list some objects that are close to the > current date. I could do this using datetime and just subtract the > two dates, but this seems like something that has probably been done > before. It seems like there would be a more Django way of

Re: correct list for newforms admin questions? named urls / replacing admin root page

2008-06-18 Thread Norman Harman
Brian Rosner wrote: > Hi Norman, > > On Jun 17, 2008, at 3:49 PM, Norman Harman wrote: > >> I want to use {% url %} to point into portions of the admin site(and >> change the default url structure). I hacked this generally >> unfullfilling but

correct list for newforms admin questions? named urls / replacing admin root page

2008-06-17 Thread Norman Harman
I want to use {% url %} to point into portions of the admin site(and change the default url structure). I hacked this generally unfullfilling but working version with old admin. model = dict(app_label="specials", model_name="adspecial") urlpatterns +=

Re: Adding suggest / accept functionality to models

2008-06-17 Thread Norman Harman
Dan wrote: > There is a functionality which I am interested in and I wonder what is > the cleanest and most foward compatible way of doing things. > > I want models to sprout a suggest() method which would work like > save() but keep the data in some structure elsewhere that do not > modify the

Re: Dictionaries, templates and best practices

2008-06-17 Thread Norman Harman
Juan Hernandez wrote: > it does not return any values. > > I did post.0.title because the dictionary is established like this: > > >>> test > {0: {'post': 'My First Post', 'title': 'My First Title'}, 1: {'post': > 'My Second Post', 'title': 'My Second Title'}} > > and it goes on and on > >

Re: unit testing and comparing dictionaries

2008-06-17 Thread Norman Harman
Gene Campbell wrote: > Thanks for the insight! Do you write tests to check for constraints > that are optional in definitions, for example? > > address4= models.CharField(max_length=45, null=True, blank=True) > > could be written as > > address4= models.CharField(max_length=45) > >

Re: serve static files

2008-06-17 Thread Norman Harman
Molly wrote: > How would I call the static file in my browser?? By typing in the url to the static file directly in the address bar. For example if your server is example.com, root of django app is myapp, and images are in img dir, and image is named myjp.jpg the url would be

Re: redirect with post parameters

2008-06-17 Thread Norman Harman
MarcoX wrote: > Peter and Daniel, thanks for the reply. > I must use the POST method because the external site WANT a post > method. > parameter2 is a "stupid" info that the external site required. > I try with your (simple) solution, a hidden html form with a > javascript redirect... I had to

Re: unit testing and comparing dictionaries

2008-06-17 Thread Norman Harman
Gene Campbell wrote: > Hello Djangonauts > > I'm a noob on both Django and Python, so this question might be easy > for the experts out there. I am trying to do test first development > during the development of my model code. (I have lots of experience > with test first coding in the Java

Re: Template engine

2008-06-13 Thread Norman Harman
Russell Keith-Magee wrote: > If there is a particular whitespace-eating behaviour that you would > like, you could always implement it yourself in a template tag. If you > think the template tag could be useful for others, you can share it on > djangosnippets.org, or open a ticket to have the tag

Re: Session lost between two requests from the test client

2008-06-13 Thread Norman Harman
ksachdeva wrote: > Hi, > > From a testcase I first issue a 'get' request to a view (say view1) > where I set a request.session['m_key'] = 'myval'. Now I issue a 'post' > request to a view (say view2). In view2, I tried to obtain > request.session['m_key'] but I get an error that session does not

Re: Template engine

2008-06-13 Thread Norman Harman
Juanjo Conti wrote: > Hi, I am using Django's template engine to produce rtf files and I > have noticed something: if the first line of my template is a {%load > ... %} tag then the result has a withe like at the to of it. This is > not a problem in html, the common use of the tempalte engine,

Re: best solution for different address formats?

2008-06-11 Thread Norman Harman
[EMAIL PROTECTED] wrote: > Hello Django-Community, > > currently I'm working on a project where I need to save the user's > postal address. The problem is that the users come from different > parts of the world and postal addresses are formatted differently in > the U.S. or in Austria. > > Does

Re: How to Implement "Most Viewed"?

2008-05-25 Thread Norman Harman
blis102 wrote: > Hello All, > > Im wondering how I could go about implementing a "Most Viewed" feature > on my site. Lets say I have events, articles, and businesses, how > could I implement a "Most Viewed Businesses", "Most Viewed Articles", > "Most Viewed Events", "Most Viewed Content", "Most

Re: item "of the day"?

2008-05-23 Thread Norman Harman
[EMAIL PROTECTED] wrote: > I think I this would be a great plan if I could get caching to work in > the template tag. Even this returns None: > > def render(self, context): > cache.set('mykey', 'hello world', 30) > return cache.get('mykey') Sounds like you have caching

Re: item "of the day"?

2008-05-22 Thread Norman Harman
[EMAIL PROTECTED] wrote: > I've tried low-level api, and must be missing something: > > class RideNode(template.Node): > def __init__(self, varname): > self.varname = varname > > def render(self, context): > if cache.get('rod'): >context[self.varname] =

Re: item "of the day"?

2008-05-22 Thread Norman Harman
[EMAIL PROTECTED] wrote: > > > On May 22, 12:11 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote: >> I don't know if this is the "right" direction but I've had success using >> memcached to implement of the day items. >> >> If the i

Re: item "of the day"?

2008-05-22 Thread Norman Harman
[EMAIL PROTECTED] wrote: > This should be really easy, but I haven't slept in a week and I'm not > that smart to begin with. I want to get an item of the day.. quote of > the day, tip of the day, whatever. > > I don't know how many of these items there will be. I am pretty sure I > want a

Re: Try Except Statement not working properly.

2008-05-21 Thread Norman Harman
Greg wrote: > Norman, > I added those print statements and ran the script. The output was > this over and over again: > > /// > > current transaction is aborted, commands ignored until end of > transaction block > > // > > Any suggestions? It sounds like some other exception is, sadly,

Re: Try Except Statement not working properly.

2008-05-20 Thread Norman Harman
Greg wrote: > Since we know what the exception is. The email address already exist > in the db (I have unique=True for the email field). I thought that > having 'except: pass' would solve that problem. However, do I need to > catch a certain exception in order for my loop to continue. Because

Re: Incrementing by 4 instead of 1?

2008-05-20 Thread Norman Harman
ringemup wrote: > Hi folks, > > I feel like I must be doing something stupid. I've got the following > view: > > def adopt_bunny(request, id): > try: > bunny = Bunny.objects.get(pk=int(id)) > except: > raise Http404 > adoptions =

Re: business logic and good practices

2008-05-20 Thread Norman Harman
bcurtu wrote: > Hi, > > The reason you must place your templates out from your app code is > because if you don't do that, anyone could access to the code via > browser. Just writing the path of your files, and they have the code. > It could be a security issue. That is not the reason, and if

Re: where does this caching come?

2008-05-15 Thread Norman Harman
Graham Dumpleton wrote: > On May 16, 12:21 am, "Norman Harman" <[EMAIL PROTECTED]> wrote: >> Alex Morega wrote: >>> On May 15, 2008, at 02:24 , David Zhou wrote: >>>> Are you restarting the server between module changes? >>> By default

Re: encrypting form data

2008-05-15 Thread Norman Harman
Gabriel wrote: > Mike Chambers gmail.com> writes: > >> >> I am not concerned if they can send the hash back. I dont want them to >> be able to access the underling value that the hash is based on. >> >> I am also not concerned about spam, but rather just dont want to expose >> raw database

Re: encrypting form data

2008-05-15 Thread Norman Harman
Gabriel wrote: > Mike Chambers gmail.com> writes: > >> >> I am not concerned if they can send the hash back. I dont want them to >> be able to access the underling value that the hash is based on. >> >> I am also not concerned about spam, but rather just dont want to expose >> raw database

Re: encrypting form data

2008-05-15 Thread Norman Harman
Richard Dahl wrote: > Mike, > I concur with jonknee, the attribute 'hidden' on a form field simply > tells a browser that is following the standards not to display it. > The form field and all of the data within it is still sent via http. > Any script or proxy (i.e. webscarab) or other mechanism

Re: encrypting form data

2008-05-15 Thread Norman Harman
Mike Chambers wrote: > I have a commenting app that requires that the item id, and content type > id be passed through the form. > > This works fine, but i would like to encrypt that data to make it a > little more difficult for people to programatically submit the form. > > Does anyone have

Re: where does this caching come?

2008-05-15 Thread Norman Harman
Alex Morega wrote: > On May 15, 2008, at 02:24 , David Zhou wrote: >> Are you restarting the server between module changes? > > By default Django does no caching of responses. It's probably what > Viktor says: the server (mod_python, mod_wsgi, whatever) won't > automatically reload the

Re: accessing dictionary elements in opening tag of django template for loop

2008-05-14 Thread Norman Harman
Sorry, I don't know the exact answer but I can point you in right direction. templates always use dot notation for dictionary access tag_dict.document.uid But I don't think that will work inside a "for" tag and also won't work cause you want the document.uid to be key not "document". The

Re: Few things ive been wondering

2008-05-06 Thread Norman Harman
phillc wrote: > first: > > How does one develop tests for django web apps? > im having trouble writing tests. > i understand there are view tests, but those are so overly complex to > write. > i was just wondering how other people approach it, and if anyone can > point me to some open

Re: At what point does a model get its own app? Wigging as I try to adjust to the Django way.

2008-04-24 Thread Norman Harman
Erik Vorhes wrote: > There's nothing wrong with parceling out models across different apps. > And unless you're planning on distributing each app separately, don't > worry about cross-app dependencies. > > In this case, I'd encourage you to--since you'll probably want to do > more than just

Re: Can I print out the context from within a template?

2008-04-18 Thread Norman Harman
Salim Fadhley wrote: > yml, > > If I want to disable this behavior, is it possible? When a template > tries to reference an invalid object (e.g. a context variable which > has not been defined) I'd like to throw an exception. I do not want to > invent a value. In my test_settings.py file I put

Re: Enterprise applications with Django

2008-04-16 Thread Norman Harman
Hussein B wrote: > In Java we have a dedicated component model for business logic (EJB) > and the ability to call remotely other components > With Java, we can create 3-tier enterprise applications not to mention > a cluster of servers. > I didn't play with Django yet but it seems to me that the

  1   2   >