Re: Working with static media files, {{ MEDIA_URL }} shows up blank even with settings.py set

2010-12-28 Thread Daniel Roseman
On Tuesday, December 28, 2010 3:02:44 PM UTC, Lee Connell wrote: > > I didn't have TEMPLATE_CONTEXT_PROCESSORS at all, I copied the code > and it did not help, MEDIA_URL is still blank. I am using django 1.2.1 > on windows. > You don't actually need to specify TEMPLATE_CONTEXT_PROCESSORS if you

Re: text in via model html out in template

2010-12-23 Thread Daniel Roseman
On Thursday, December 23, 2010 10:23:40 AM UTC, MikeKJ wrote: > > > re phrased heading as this is the real problem > > model: > data = models.TextField(help_text='This is the embedding popup code for the > video', null=True, blank=True) > > method: > def data(self): > return self.data >

Re: Django queryset custom manager - refresh caching

2010-12-20 Thread Daniel Roseman
On Monday, December 20, 2010 11:03:10 AM UTC, LaundroMat wrote: > > Hi - > > Django seems to be caching data that I query through a custom method on a > model. I've tried to describe the issue over at SO ( > http://stackoverflow.com/questions/4010317/django-queryset-custom-manager-refresh-caching)

Re: Forbidden (403) - CSRF verification failed. Request aborted.

2010-12-20 Thread Daniel Roseman
On 17 December 2010 19:46, hank23 wrote: > Thanks for the note. Below is the screen code again which I've changed > a little, plus the two views which deal with it. Let me know if you > need anything else. Here's the screen code: > > Add Poll Question Screen > > {% if error_message %}{{ error_mes

Forbidden (403) - CSRF verification failed. Request aborted.

2010-12-17 Thread Daniel Roseman
It's not just the view that processes the form that needs RequestContext - the one that generates it does too. Normally these are the same view, but it looks from your code that you are posting to a different view. Perhaps you could show the code of the other one and we'll see what is wrong with

Re: Order a QuerySet by Method

2010-12-15 Thread Daniel Roseman
On Wednesday, December 15, 2010 1:34:15 PM UTC, josch wrote: > > Hallo, > > I know, that the normal way to do that is to write the return value of > the method to the foreign model, always when a model that affects the > return value changes, and than order by that value of the model. > > But I

Re: ForeignKey search

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 2:54:12 PM UTC, Michele JD Granocchia wrote:(django 1.2) Hi, i need to do the following: Class 1, with a field called "field1" (CharField) Class 2, with a field called "fieldwfk" (ForeignKey) User enters a text and submits, which goes into "searchtext" --- searchtext

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 11:20:21 AM UTC, Scoox wrote:Hi Daniel, thanks for your answer. Sorry, cmp should be c. I tried to only give the import parts to make it more readable, but I made a mistake there. The model code is pretty standard, except for one function: isEditable=0 login=0 def edit

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 10:22:32 AM UTC, Scoox wrote:Hi guys, I have a (probably easy) question. I need to pass the logged in user to my objects. I have the objects company and offer. I tried the following on the project's index / start view: c = Company.objects.all() cmp.login=request.use

Re: Limit number of concurrent non-admin/non-superuser users

2010-12-10 Thread Daniel Roseman
On Dec 10, 3:07 pm, Stodge wrote: > I'm trying to limit the number of concurrent users attached to my > Django website. For example I need to implement a floating license > system. I've seen a few snippets but so far I think they all implement > a middleware. I'm trying to avoid using a middleware

Re: problem writing a unittest

2010-12-10 Thread Daniel Roseman
On Dec 10, 6:53 am, Kenneth Gonsalves wrote: > hi, > > I am trying to write a unittest, but am getting an error. > > django version - trunk > model: > > class Nums(models.Model): > >     num1 = models.IntegerField("First number") >     num2 = models.IntegerField("Second number") >     def addit(se

Re: User not authenticated after login?

2010-12-08 Thread Daniel Roseman
On Dec 8, 3:20 pm, gunnar wrote: > Dear group, > > I run django 1.2 on windows on the development server. > > I set up a login site via the standard django login view. The user is > then redirected to a site built from a base template. The view that > calls the base template is only available to l

Re: Named URLs and class-based generic views

2010-12-03 Thread Daniel Roseman
On Dec 3, 8:47 pm, Andrew Willey wrote: > Forgot to in mention the actual question from the subject. > > Is there a "blessed" way to use class-based views with named urls in > the > > > url(r'^location/$', view='WouldLoveToHaveClassBasedView.as_view', > > name='name_for_convenience') > I don't u

Re: signal locations

2010-12-01 Thread Daniel Roseman
On Dec 1, 5:29 pm, garagefan wrote: > Now, i've read the thread in regards to putting the import in the > __init__.py > > here is my structure > > website_project > - > signals > - - > signals.py (and an __init__.py) > - > shared_apps (link to numerous apps shared amongst other projects) > - - > g

Re: get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-01 Thread Daniel Roseman
On Dec 1, 6:20 pm, Pranav wrote: > Hi all, > > I'm new to django and python and i'm working on a project that works > with a legacy database. > I've a particular problem with a "composite key" and "get" or > "get_object_or_404". > > i generated the below model form the legacy database using inspec

Re: minidom parsestring error

2010-12-01 Thread Daniel Roseman
On Dec 1, 1:18 pm, vamsy krishna wrote: > Hi, > > I have a function to read and display an RSS feed which is working as > expected in my local Apache. However I'm getting a HTTP 502 error when > I access the same on Webfaction. Below is a snippet from my code and > the error is originating from th

Re: list_display with a function

2010-12-01 Thread Daniel Roseman
On Dec 1, 11:17 am, Daniel Carvalho wrote: > hi > > I have a model that defines a function: > > class Test(models.Model): >     name = models.CharField(max_length=200) > >     data_expira = models.DateField() > >     def expired(self): >         return self.data_expira < datetime.date.today() > >

Re: Where's the form value set for comments framework/app

2010-11-30 Thread Daniel Roseman
On Nov 30, 8:31 am, photon wrote: > Mostly I followed the instruction > ofhttp://docs.djangoproject.com/en/dev/ref/contrib/comments/ > > While my code could run as expected, I cannot find when and where the > field values in "form" are set before it's called in line 4~6 of the > form.html as belo

Re: Issues importing models in between apps

2010-11-30 Thread Daniel Roseman
On Nov 30, 6:01 am, Victor Hooi wrote: > Hi, > > I had an application with a fairly large models.py file, which I split > up into separate apps to make it easier to manage. > > Two of the apps are called "conferences" and "people", each with their > own models.py. > > These two are fairly tightly

Re: Error in ajax request

2010-11-29 Thread Daniel Roseman
On Nov 29, 8:28 pm, James Matthews wrote: > Hi, > > When I use this rate > limiterhttp://www.levigross.com/post/1721427025/django-rate-limitingand > preform an > ajax request I get this error > > django/middleware/common.py", line 84, in process_response >     if response.status_code == 404: > A

Re: generic views template problem

2010-11-29 Thread Daniel Roseman
On Nov 29, 7:08 pm, Carlos Aboim wrote: > Guys, > Someone can tell me what is happening with my generic > views? > > I have the templates in my application folder 'templates' in the root > my project. > This folder is referenced in settings such as: > TEMPLATE_DIRS = ( >     os.path.join (PROJECT_

Re: Django on a hosting service

2010-11-28 Thread Daniel Roseman
On Nov 28, 3:20 am, Todd Wilson wrote: > I'm helping some friends improve a portal website they have created > using PHP, but which would be ideal for Django, in the sense that a lot > of the work they've already done, and would like to do as they improve > the site, would be easy to do in Django.

Re: populating model values into form

2010-11-27 Thread Daniel Roseman
On Nov 27, 1:11 pm, djangobeginner wrote: > Hi, > Im a beginner here, would just like to ask how to pass and populate > model values (from database) into a created form, I have the following > codes > > 1. I already have a webpage list of all the values in a table form > 2. If I click on any of th

Re: Dynamic db_table change

2010-11-26 Thread Daniel Roseman
On Nov 26, 2:34 pm, Seb wrote: > Hi all ! > > I want to use Django on an existing database where every user have his > own table. > Any idea ? Yes: don't do this. Really, really, don't do this. There's absolutely no reason for each user to have their own table. It breaks not only Django's ORM,

Re: PIL issue opening an image file

2010-11-26 Thread Daniel Roseman
On Nov 26, 3:16 pm, Sithembewena Lloyd Dube wrote: > Bruno, the file being uploaded has nothing to do with the deployment server. > When you edit your Google profile to change your avatar, does the file > upload dialogue browse a Google server? No. But that has nothing whatever to do with the pro

Re: PIL issue opening an image file

2010-11-26 Thread Daniel Roseman
On Nov 26, 2:03 pm, Sithembewena Lloyd Dube wrote: > I found the issue: it is the path to the image. When I change the problem > line to > > image = Image.open(os.path.realpath('C:\Users\Lloyd\Desktop\Lloyd.png')) > > it works, but I cannot hard code the path and I cannot predict where the > user

Re: Custom Login using model form

2010-11-26 Thread Daniel Roseman
On Nov 26, 8:00 am, PRANAV HEGDE wrote: > Hi Daniel, > > Yeah I had a thought like that. I thought I could leave the validation > to the model. > Turns out model form comes handy only if your modifying or updating > something in the database, as you said. > Simple form can also enforce constraints

Re: Custom Login using model form

2010-11-25 Thread Daniel Roseman
On Nov 25, 7:53 am, PRANAV HEGDE wrote: > Hi guys, > > I'm trying to create a login form using a model form, > > user model: > class users(models.Model): >     username = models.CharField(max_length=20, primary_key=True) >     password = models.CharField(max_length=50) >     usertype = models.Char

Re: tree data structure

2010-11-25 Thread Daniel Roseman
On Nov 25, 10:47 am, pa_ree wrote: > i want to create a tree data structure for an organizational project > for eg at the root level i want the project leader, under him would > work the project manger, under him the project members and so on > plz help http://github.com/django-mptt/django-mp

Re: Sample Auto Log Out Code

2010-11-24 Thread Daniel Roseman
On Nov 24, 4:23 pm, octopusgrabbus wrote: > Sorry for the late reply. Most of my users will not remember to log > out. After, say four hours, I'd like to log them out, if of course > they're not already logged out. That's just a matter of setting session cookies to expire properly. You need to se

Re: tutorial part 4: ImportError

2010-11-23 Thread Daniel Roseman
On Nov 23, 4:06 pm, steph wrote: > Hi group, > > I'm new - just worked thgough the tutorial. In part 4 about the use of > generic views I've got a problem - I can't import ListView and > DetailView: > > >>> from django.views.generic import DetailView > > Traceback (most recent call last): >   File

Re: Hosting multiple projects

2010-11-23 Thread Daniel Roseman
On Nov 22, 9:42 pm, Todd Wilson wrote: > I teach a course in which I have students developing unrelated Django > projects on servers of their own choice.  As we near the end of the > semester, I would like to set up a single server where I can host all > of these student projects together.  I will

Re: Not main content on site - how to?

2010-11-21 Thread Daniel Roseman
On Nov 21, 11:54 am, robos85 wrote: > I'm wondering how to make a sidebars on my site. Main content is not a > problem - I use views to do that. What about the rest of site content? > I want for example to have last comments, last posts, the most popular > posts and the most rated. How to plan tha

Re: Generic relation overflows the maximum recursion depth

2010-11-19 Thread Daniel Roseman
On Nov 19, 3:46 pm, Jonas Geiregat wrote: > I'm trying to save a model and then insert it into a generic relation. > Having this models.py file: > > from django.db import models > from datetime import datetime > from django.conf import settings > from django.contrib.contenttypes.models import Cont

Re: Newbie: can't login as user via standard admin login page

2010-11-18 Thread Daniel Roseman
On Nov 18, 1:58 am, john doe wrote: > On Wed, Nov 17, 2010 at 5:48 PM, Thomas Schreiber wrote: > > Are you sure the user has been marked as is_staff or is_superuser? > > >http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth... > > No the user is not marked as either because it is

Re: how to add poll app in Admin page

2010-11-17 Thread Daniel Roseman
On Nov 17, 1:48 pm, frank wrote: > hi all > > i followed each step in tutorial to create poll app...i am able to see > the admin page...when i added the Admin class to Poll class as inner > class, i am not getting the poll app interface in admin page..what to > do>>> You must be following a very

Re: Can I inport recaptcha?

2010-11-17 Thread Daniel Roseman
On Nov 17, 9:55 am, robos85 wrote: > I'm not guru in server side commands:) > I have access to command line. I'm in python console but don't know > what to do next to add this module. eazy_install requires root so I > can't just install it:/ Sigh. For the third time: just run this command: py

Re: Can I inport recaptcha?

2010-11-17 Thread Daniel Roseman
On Nov 17, 9:28 am, robos85 wrote: > So, it's not possible to import it just from my project dir? > The only way it to ask my hosting provider to install it? I have SSH > terminal but I wanted it to be more portable and put it in my > project:/ That's completely the opposite of what I just said.

Re: Can I inport recaptcha?

2010-11-17 Thread Daniel Roseman
On Nov 17, 9:11 am, robos85 wrote: > Hi, > I want to use reCaptcha on my site. It requires to add recaptcha > module. Is it possible to not to add this to python modules, but place > somewhere in my app, and then import it from there? > > I placed it in my project main dir, co path looks like this

Re: How to pass template variable to tag in Django?

2010-11-15 Thread Daniel Roseman
On Nov 15, 9:00 am, DD wrote: > I try to pass a template variable to a tag as parameter, not sure how > it works. > > For instance > > in template html > >     {{ question.author_id }} > >     {% monetize_slot question.author_id "questioner" %} > > Here I can see the webpage show question.author_i

Re: Can't move down then up the directory tree for inserting of html files

2010-11-14 Thread Daniel Roseman
On Nov 14, 1:28 pm, Brian wrote: > Thanks for the help, Still can not get it to work. > > I changed TEMPLATE_DIRS setting 30 ways. > > I can't seem to move down the dir tree for inserting of html files > using  {% include "file" %} statement, Works just fine to any where up > the tree, i can go up

Re: Static files ...

2010-11-13 Thread Daniel Roseman
On Nov 13, 10:24 pm, Jon Snidal wrote: > Hello, > > First post to the group, and sorry it's on this common subject!  I > have tried to read every post on this and cannot seem to get it.  I'm > using Django 1.2.3, and therefore believe the instructions here apply: > > http://docs.djangoproject.com/

Re: TemplateDoesNotExist

2010-11-12 Thread Daniel Roseman
On Nov 12, 7:23 pm, "lch...@gmail.com" wrote: > I'm trying to update a website that I didn't create that uses Django, > but am running into some issues. > > 1. I use the Django Admin site to create a new flat page > 2. I create a new file named "yourname.html" > 3. I FTP the file to my server > >

Re: Django cache view

2010-11-12 Thread Daniel Roseman
On Nov 12, 2:22 pm, Mathieu Leduc-Hamel wrote: > Hi all, > > I'm working on a e-commerce website and to make it work better we've > implemented a couple of caching strategy. But i was wondering, in our > system, we are using the cache middleware and the decorator to mark > some views as cacheable.

Re: Downloading files

2010-11-12 Thread Daniel Roseman
On Nov 12, 6:29 am, vikash rai wrote: > Hi, > > I am new to django . > From html page I want to download a file from a location in my local > system . I am using django server and not the apache/lightpd. > By the following code I am able to get the dialouge box on clicking the > link on web page .

Re: Creating A Model For Existing DB Table

2010-11-10 Thread Daniel Roseman
On Nov 10, 5:23 pm, octopusgrabbus wrote: > I have an existing MySQL table. It's fairly straightforward: > > part_num char(20) > ept_type smallint (default 0) not null > inv_id integer (default 0) not null > load_date date > > columns 2 and 3 (ept_type and inv_id) form a unique key. An example of

Re: getting a variable in a templatetag

2010-11-10 Thread Daniel Roseman
On Nov 10, 11:19 am, Kenneth Gonsalves wrote: > hi, > > using trunk. I have line in template like this: > >     {% get_current_language as LANGUAGE_CODE %} > I want to pass the current language to a templatetag for some > processing. So i call it like this: > > {% get_menu "LANGUAGE_CODE" %} > > t

Re: Making MODEL.objects.raw() query with LIKE input%

2010-11-10 Thread Daniel Roseman
On Nov 9, 10:06 pm, xvga wrote: > Hi All, > >  my question is linked to this thread, so I post here > > I need to run sql query with LIKE and % in the end - I have tried %% > and : > CLASSNAME.objects.raw("select * from table where full_name like %s%% > ", [user_input]) > this is what I get as

Re: Can't move down then up the directory tree for inserting of html files

2010-11-10 Thread Daniel Roseman
On Nov 10, 2:32 am, Brian wrote: > Thanks for the help. > I'm using Python 2.5 and Django Template 1.1 > > I can't seem to move down then up the directory tree for inserting of > html files using  {% include file %} statement > > Sample dir structure: > root/ > root/lib/ > root/lib/Top.html > root

Re: Please help me figure out this UnicodeEncodeError

2010-11-10 Thread Daniel Roseman
On Nov 10, 2:25 am, Eric Chamberlain wrote: > Hi, can anyone tell me how to work around this UnicodeEncodeError? > > >>> from hashlib import md5 > >>> full_jid = u'e...@example.com/Eric\u2019s iPhone 3GS' > >>> hash = md5(full_jid) > > Traceback (most recent call last): >   File "", line 1, in >

Re: "Include" tag and dynamically generated file to include

2010-11-09 Thread Daniel Roseman
On Nov 9, 10:25 am, "samuele.mattiuzzo" wrote: > Hi all, > i have a problem with a django template. > > i have a value (a number) stored into a mysql database and i'm > accessing it using {{ totem.layout.communitySpace }} > > This number sould be used to get a page: > {% include "bacheche/clip_{{

Re: Validator for \t

2010-11-09 Thread Daniel Roseman
On Nov 9, 9:11 am, Ralf Peschke wrote: > Thank you for your response, Cliff. > But the strip-command wasn't my problem. I wondered why Django let pass > these kind of invalid input and if there is an easy way to toggle this > behavior for the whole project. I could not find anything in the Django

Re: Obtaining And Caching User Context

2010-11-08 Thread Daniel Roseman
On Nov 8, 5:54 pm, octopusgrabbus wrote: > I am able to log into my form page, which is a simple form asking the > user for one value. If that value is entered successfully, I am able > to redirect to another "you were successful" page. However, my > template logic that checks to see if the user i

Re: Can extra() be used to implement JOIN?

2010-11-08 Thread Daniel Roseman
On Nov 8, 3:40 pm, Andy wrote: > I have a Q&A type of site with the following models: > > class Question(models.Model): >     title = models.CharField(max_length=70) >     details = models.TextField() > > class Answer(models.Model): >     question_id = IntegerField() >     details = models.TextFie

Re: Why Won't Form Elements Display?

2010-11-05 Thread Daniel Roseman
On Nov 5, 12:10 pm, octopusgrabbus wrote: > Thanks. I put back the {% block title %}, {% block head %}, and {% > block content %} directives, corrected the error in forms.py, but the > field still won't display. Any other ideas to try? Not really. Do those blocks exist in the parent template? Can

Re: inserting bits of javascript into individual pages

2010-11-05 Thread Daniel Roseman
On Nov 5, 8:26 am, Ellen wrote: > Dear all, > > I am just learning the ropes of django so please direct me to a better > place if my question has been asked a million times before or plain > ridiculous. > > I am managing a website that uses the django platform -- I am not > responsible for buildin

Re: Sample Auto Log Out Code

2010-11-05 Thread Daniel Roseman
On Nov 3, 12:43 pm, octopusgrabbus wrote: > Does anyone have samples for auto logging out a user? What do you mean by 'auto logging out'? -- DR, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@

Re: Sample Auto Log Out Code

2010-11-05 Thread Daniel Roseman
On Nov 5, 6:51 am, derek wrote: > Fred > > This seems not related to the original topic; please start a new > thread. That seems to be a constant issue with Fred's posts: I think every one of his that I've seen has been added onto the end of an existing thread, while changing the subject. Fred,

Re: Why Won't Form Elements Display?

2010-11-04 Thread Daniel Roseman
On Nov 4, 10:32 pm, octopusgrabbus wrote: > I have a forms class in forms.py > > from django import forms > > class ReadSnapForm(forms.Form): >     cycle = forms.CharField(max_length=1) >     message = forms.CharField(widget-forms.Textarea,required=False) > > Here is the form that uses the class >

Re: Django Environment Settings

2010-11-04 Thread Daniel Roseman
On Nov 4, 1:18 pm, octopusgrabbus wrote: > What is the best way to set the Django command line environment for > testing in the python interpreter? ./manage.py shell -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: using strings as fieldnames to save model

2010-11-03 Thread Daniel Roseman
On Nov 3, 4:17 pm, Thomas M wrote: > Hi, > > I have to save a model with dynamic fieldnames. So the field > identifiers are strings. > > Example: > foo  = Genre("genre_id"=2,"name"="ente") > foo.save() > > This creates an error. Is it somehow possible to do this with the > model instance? > Or do

Re: RadioSelect widget in Django 1.1 using Model Form

2010-11-03 Thread Daniel Roseman
On Nov 3, 3:03 pm, "Ricardo L. Dani" wrote: > Hello, > > I'm working with an project using django-cms and django 1.1 and I have this > problem: > > With a big model form with many choice charFields must be reendered as > and not as 's (default) > > Ex: > >     field = models.CharField(max_length=

Re: django-voting url pattern

2010-11-02 Thread Daniel Roseman
On Nov 1, 3:08 pm, Sithembewena Lloyd Dube wrote: > Thanks Daniel, makes sense. Also, I was making the mistake of thinking that > I had to create a separate view, forgetting that I am calling the one > supplied by django-voting. That correct? I'm not familiar with django-voting, but yes that soun

Re: Mod_Python and everything loaded, Apache serving HTML files without using Django first

2010-11-02 Thread Daniel Roseman
On Nov 1, 9:15 pm, The End wrote: > I've finally got mod_python and mysqldb working with apache (long > story short, can't install wsgi for various reasons and i'm using > python 2.4.3... for various reasons...). > > However > > Now when i load up the home page (just typing 'localhost' into > fire

Re: django-voting url pattern

2010-11-01 Thread Daniel Roseman
On Nov 1, 1:23 pm, Sithembewena Lloyd Dube wrote: > Hi all, > > I have django-voting installed and am trying to get through the 'recipe'.  I > have a url pattern which (I expect) should route voting actions to a view. > > Problem is, which view or views should handle this? The URL pattern is as >

Re: 2D map application: performance and design question

2010-11-01 Thread Daniel Roseman
On Nov 1, 9:59 am, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps with Django, and i only have > limited experience with Python, so please be patient. > > I'm using it for what is intended to be a browser game in the future. > The main part of the game is a zoom view on a tw

Re: cannot setup database

2010-11-01 Thread Daniel Roseman
On Nov 1, 7:24 am, sami nathan wrote: > My setting file looks like this ... > DATABASES = { >     'default': { >         'ENGINE': 'django.db.backends.sqlite3', # Add > 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >         'NAME': > 'D:\Python25\Lib\site-packages\django\bi

Re: Call a function after a model with inlines is created

2010-10-31 Thread Daniel Roseman
On Oct 31, 4:46 pm, Martin Tiršel wrote: > Hello, > > I have two models BillingRequest and BillingRequestItem. I am using admin   > and inlines, so when I am creating BillingRequest, I have some fields for   > BillingRequestItems. Now, I need to send an email with some information   >  from both m

Re: Tracking changes of a model

2010-10-30 Thread Daniel Roseman
On Oct 30, 11:15 am, Martin Tiršel wrote: > Hello, > > I am using Django admin to create/update some records. Now, I need to   > track changes. After somebody updates a record, I need to see what was   > changed and then create a text log like: > > changed `name`: oldvalue -> newvalue, > changed `

Re: can't open file 'django-admin.py': [Errno 2] No such file or directory'.

2010-10-30 Thread Daniel Roseman
On Oct 30, 6:00 am, sami nathan wrote: > Whenever I try to execute a python script that is located in the > /usr/local/bin, python gives me the error 'python: can't open file > 'django-admin.py': [Errno 2] No such file or directory'. That makes no sense. That message is a Windows error, and Windo

Re: Import csv file in admin

2010-10-28 Thread Daniel Roseman
On Oct 28, 5:08 am, Jorge wrote: > Shame on me! > I forgot to make some changes inside the for loop. > So now it is: > >  def save(self, commit=True, *args, **kwargs): >          form_input = super(DataInput, self).save(commit=False, *args, >  **kwargs) >          form_input.place = self.cleaned_d

Re: Problem with Mysql Quires in django

2010-10-27 Thread Daniel Roseman
On Oct 27, 10:19 am, Jagdeep Singh Malhi wrote: > hi > I want to use this mysql Query > " SELECT count(*) as class_roll_no FROM student_profile where > class_roll_no !='00 '  "; > in my  view file > > Is it possible? > > I try this code > view.py file is : > > from django.shortcuts import render_t

Re: Import csv file in admin

2010-10-27 Thread Daniel Roseman
On Oct 27, 4:27 am, Jorge wrote: > I'm trying to poblate a database with a csv file using the modelform > in Admin site. Here's the files: > > Models.py: > > class Data(models.Model): >         place = models.ForeignKey(Places) >         time = models.DateTimeField(blank=True) >         data_1 = m

Re: for loop logic in template

2010-10-27 Thread Daniel Roseman
On Oct 27, 5:33 am, jimgardener wrote: > hi > I have a model with 3 fields > class Employee(models.Model): >     name=models.CharField(max_length=50) >     home_address=models.TextField(blank=True) >     change_filter=models.IntegerField() > > I am creating a modelform using this class as model. >

Re: change the default widget to a field in a modelform

2010-10-27 Thread Daniel Roseman
On Oct 26, 7:54 pm, refreegrata wrote: > maybe I not explain correctly. For any modelForm the forms for a field > "ManytoMany"  are "select multiple". If I want to change this I must > to redefine the widget for that field in the declaration of the > "modelForm". This works correctly, I can transf

Re: nl2br or equivalent to django

2010-10-26 Thread Daniel Roseman
On Oct 26, 5:02 pm, refreegrata wrote: > Hello list, I have a newie question, are in django some function like > nl2br in the template to print data saved previously from a > "textarea"? because in my template all the lines are printed in the > same line. > > P.D.: nl2br is PHP function to do this

Re: Access to field name in upload_to?

2010-10-26 Thread Daniel Roseman
On Oct 26, 4:29 pm, Scott Gould wrote: > Hi folks, > > I've got all my file uploads (that go to S3 as it happens, but I don't > think that's overly important) taking their path from one upload_to > delegate: > > def get_upload_path(instance, filename=None): >         """ >         Defaults to appn

Re: Graphic and form in the same template

2010-10-26 Thread Daniel Roseman
On Oct 26, 3:08 pm, Waleria wrote: > I know that the execution of the function stops there, but i don't > know how do i resolve. I need to display the graphic generated and > just below the form. > > Can you help me, please? > > Thanks Well as far as I can tell, the generated graphic doesn't depe

Re: Graphic and form in the same template

2010-10-26 Thread Daniel Roseman
On Oct 26, 2:17 pm, Waleria wrote: > Hi all, > > I have this code:http://pastebin.com/Ra1G7twn > > I need to display the graphic generated and just below the form, now > the code only display the form. The image of graphic isn't displayed. > > What could it be? > > How do i resolve? > > Thanks I

Re: Admin without template (no colors, no css, just simple html)

2010-10-26 Thread Daniel Roseman
On Oct 26, 1:25 pm, Giancarlo Razzolini wrote: > I had this same problem when hosting it with apache. I solved the > problem by creating a symbolic link inside my media folder pointing to > the admin site that is instaled with django. Something like this: > > admin -> /usr/share/pyshared/django/co

Re: choosing queryset

2010-10-26 Thread Daniel Roseman
On Oct 26, 1:29 pm, vamsy krishna wrote: > I've two modules called plan and income and both have a class called > Income in their respective models. Now if I do user.income_set, it is > accessing the income set under plan. How do I alter it to access > income.income? Any ideas? > > Thanks in advan

Re: Global variable during request

2010-10-22 Thread Daniel Roseman
On Oct 22, 5:35 pm, Jop wrote: > Hello all, > > I've been googeling for a while but haven't been able to find a > solution for my problem. I will try to describe the problem > > I want to be able to set a variable in a view function on the start of > the request. During the same request i want to

Re: RelatedManager bug?

2010-10-21 Thread Daniel Roseman
On Oct 21, 4:01 pm, Lucasm wrote: > It seems that the following does not work as expected: > > from django.db import models > > class MyManager(models.Manager): >     def create(self, *args, **kwargs): >         print "I am called!" >         return super(MyManager, self).create(*args, **kwargs) >

Re: Adding relationship to User model

2010-10-21 Thread Daniel Roseman
On Oct 21, 8:59 am, easylancer wrote: > I want to create s many to one in the users model so that a account > can contain many users. How do i do this since User model exists in > django core? Create a userprofile model with a OneToOne relationship with User, and give that a foreign key to Accoun

Re: querying against two foreign keys

2010-10-21 Thread Daniel Roseman
On Oct 21, 12:47 pm, Franklin Einspruch wrote: > In my database there are tables for ArtworkImage, Artwork, and Artist. > Every ArtworkImage belongs to an Artwork, and every Artwork belongs to > an Artist. > > class Artist(models.Model): >     directory = models.CharField(max_length=128) # this is

Re: Heriter charField

2010-10-20 Thread Daniel Roseman
On Oct 20, 6:40 pm, updo wrote: > Bonjour à tout le monde > Je voudrai creer une classe passwordField qui va heriter de la classe > charField afin de crypter les mots dans la base de donnée , je > voudrai  savoir quelles sont les méthodes de la classe faudra > redéfinir pour que quand je cree une

Re: Displaying a template table using a query set

2010-10-20 Thread Daniel Roseman
On Oct 20, 8:29 am, Pranav wrote: > I'm trying to display a table in template using the result retrieved > from a query set, but i get problem when i try to display the table > iterating through each row'' and column'' > > view file: > from django.shortcuts import get_object_or_404, render_to_resp

Re: Expense of django query

2010-10-20 Thread Daniel Roseman
On Oct 19, 9:46 pm, Ed wrote: > Thanks for the answers.  I thought that the view was already pulling > the data.  I didn't realize it gets pulled when called in the > template.  I was able to rewrite the view to provide the data more > efficiently. > > I have another related question on the topic

Re: Different logins in same browser session and login_required

2010-10-20 Thread Daniel Roseman
On Oct 20, 8:11 am, PyMan wrote: > > Firefox has long had its "profile" functionality. > > > firefox -no-remote -ProfileManager > > > You can create multiple firefox profiles, then run multiple instances of > > firefox at once - so long as you use different profiles for them.  A bit > > fiddly, bu

Re: Expense of django query

2010-10-19 Thread Daniel Roseman
On Oct 19, 4:43 pm, Tom Evans wrote: > On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman wrote: > > The solution here is to evaluate the queryset in your view first, > > before passing it to the template. You can do this by simply calling > > list() on it - eg instead of def

Re: Session issues in Internet Explorer

2010-10-19 Thread Daniel Roseman
On Oct 19, 3:13 pm, Quiet Light Development wrote: > Hello, > > I am having trouble getting sessions to work with my production > server. When I move from one page to the next and try to call > request.session["app"] it is giving me a key error even though I know > I had set it in the previous pag

Re: Expense of django query

2010-10-19 Thread Daniel Roseman
On Oct 19, 3:45 pm, Ed wrote: > I have a table for Actor that I query and populate the result in > actor_list to pass to the template. I installed the Django Debug > Toolbar to check the queries hitting the database and found some > strange behavior. If I iterate through the actor_list, only one S

Re: per thread variables

2010-10-17 Thread Daniel Roseman
On Oct 18, 3:47 am, tinku99 wrote: > Does django allow per thread variables ? > Something like cherrypy's:  cherrypy.thread_data (http:// > tools.cherrypy.org/wiki/Databases). > > I want to connect to use sqlite's fts3 module, so I need to write my > own sql queries... What do the two halves of t

Re: The problem about load css/js when developing.

2010-10-17 Thread Daniel Roseman
On Oct 17, 2:49 pm, Cancer wrote: > Hello,everyone. > > I want to load the css/js files in my development. > > I write the code follows in my "urls.py" accordding to "How to serve static > files " > >  (r'^yzx_media/(?P.*)$', 'django.views.

Re: multiple views function in a single URL specification

2010-10-17 Thread Daniel Roseman
On Oct 17, 6:16 pm, John Yeukhon Wong wrote: > I asked this somewhere else but it seems like the responder hasn't > reply the latest comment I > made.http://stackoverflow.com/questions/3951758/how-do-you-iterate-over-a-... > > Nevertheless, I think I should be welcome to make one here. > > Let's

Re: modelformset_factory, initial, and queryset

2010-10-17 Thread Daniel Roseman
On Oct 16, 4:36 am, Tim Valenta wrote: > I have a model like such: >     class Response(models.Model): >         raw_text = models.TextField() >         respondent = models.ForeignKey('auth.User') > > Response has a related model attached to it: >     class Code(models.Model): >         response =

Re: fields in inner join

2010-10-17 Thread Daniel Roseman
On Oct 15, 4:43 pm, refreegrata wrote: > ok, thank for reply. > > I think that with this query: > > " AA.object.filter(...).select_related( field related in BB ) " > > The impact in the performance is minimun > > But with this query > > " AA.object.filter(...).select_related() " > > the impact is

Re: Need help with django url errors

2010-10-17 Thread Daniel Roseman
On Oct 17, 8:36 am, codingJoe wrote: > All, > > I am working through the django tutorial on the bitnami stack and am > having difficulty getting my urls to work properly.  The following > references the tutorial part 3 - Poll details.    I suspect the > problem may be that the bitnami stack uses a

Re: Django admin, dynamic list_display. some kind of caching?

2010-10-16 Thread Daniel Roseman
On Oct 16, 12:57 pm, lipt0n wrote: > Hi, > I'm trying to make a list_display dynamically from other model. > > it looks like that: > models: > > class Headers(models.Model): >     name = models.IntegerField() >     active = models.BooleanField() > class Table(models.Model): >     p1  =   models.Te

Re: fields in inner join

2010-10-15 Thread Daniel Roseman
On Oct 15, 4:19 pm, refreegrata wrote: > Hello, how can i get fields from different tables related for a > foreign key? > > When I do a inner join like > > AA.objects.filter(bb__field = ...) ... > > I just can access to the AA fields, and not to fields in the other > table > > in a normal query i

<    4   5   6   7   8   9   10   11   12   13   >