Re: How do you retrieve a username that is not in the URL?

2009-04-14 Thread Daniel Roseman
On Apr 14, 11:12 pm, stkpoi wrote: > I would like the url to not include the user's name.  For example, it > would be "/submit" and not "/submit/joe_user". > > request.user.username is not working for me. > > # Model > class Submission(models.Model): >     title = models.CharField(max_length=200)

Re: Grasping apps / projects and shared data

2009-04-14 Thread Daniel Roseman
On Apr 14, 9:47 pm, Leon wrote: > Hello! > > I'm new to django so far I like it, but I've now reached my first big > hurdle. > > I'm building a page which has a cms in the root, which shows the main > menu, and submenu of the site, > but then I have a blog app and a gallery app which are coupled

Re: Trying to wrap my head around nested regroups or other ways to handle ordered ForeignKey stuff

2009-04-14 Thread Daniel Roseman
On Apr 14, 6:11 pm, Kevin Cole wrote: > Hi, > > First let me say I've looked at documentation, but feel a bit dyslexic > when it comes to this stuff. > > The situation: I have three tables: a service provider table with > city, state abbreviation and country abbreviation (among other other > info

Re: RadioSelect widget not rendering

2009-04-14 Thread Daniel Roseman
On Apr 15, 7:10 am, Adam Yee wrote: > Can't get the forms.RadioSelect widget to render.  I'm using svn > 10559, I've looked over forms/widgets.py, but I don't know...  I'm > able to use forms.CheckboxSelect just fine. > > Is it Firefox giving me issues?  What's going on here? > > #forms.py > clas

Re: Error: no module named manager

2009-04-15 Thread Daniel Roseman
On Apr 15, 2:14 am, Daniel Sisco wrote: > All: > > I'm adding an app (from django snippits) that is just a template tag > for a calendar application in my blog. This is the new directory > structure: > > /apps/postcal >               | >               --> __init__.py >               | >  

Re: Auth permitions in templates

2009-04-15 Thread Daniel Roseman
On Apr 15, 9:32 am, Gil Sousa wrote: > Hi! > > I have one menu that I use as a "base" template, this menu has some > entries which some of them should be restricted to logged users, but > even when I loggin I cannot see those entries. > > This is my menu.html: > > "http://www.w3.org/TR/xhtml1/DT

Re: residual fields admin error

2009-04-15 Thread Daniel Roseman
On Apr 15, 4:24 am, CrabbyPete wrote: > I am just starting coding with django. So please bear with me. > > I made a change to my User model so the field email_addr is now email. > I deleted the database, made new tables with manage.py, did a resync, > and changed all the code that refered to emai

Re: Auth permitions in templates

2009-04-15 Thread Daniel Roseman
On Apr 15, 11:56 am, Gil Sousa wrote: > I am new with django, sorry about this kind of questions. > > I don't know how to pass the 'user' variable into the template, how > can I do that? > > Thanks for your help! > The same way you pass all the other variables when you render the template. Or,

Re: Problem with self referencing Foreign key field and mysql InnoDB

2009-04-16 Thread Daniel Roseman
On Apr 16, 8:33 am, limas wrote: > I were using Mysql MyISAM. But I want to enable transaction. > So i shifted to InnoDB. > Actually I have one model as below (*designed somebody i can't > change). > > class Folder(models.Model): >         folder_id=models.AutoField(primary_key=True) >         us

Re: Django admin question

2009-04-16 Thread Daniel Roseman
On Apr 16, 2:18 pm, zayatzz wrote: > http://docs.djangoproject.com/en/dev/intro/tutorial02/#adding-related... > > On that page is small picture of adding choice to a poll. There is > selectbox and textfields. > > My question is - how to choose which field of poll model will be shown > in this sel

Re: Django admin question

2009-04-16 Thread Daniel Roseman
On Apr 16, 2:47 pm, zayatzz wrote: > So this means, that i can return whichever other value with this > unicode method... even value from other models? > > Alan. If you want, and you've got a way of getting there from the current model - eg via a foreign key. Bear in mind though that this value

Re: Getting the Model type of an unknown object?

2009-04-16 Thread Daniel Roseman
On Apr 16, 6:02 pm, Matthew wrote: > Is it possible to do this? > > I'm using a custom MultiQuerySet snippet to merge a bunch of querysets > from different models, and then I want to iterate over the resultant > list, but I want to be able to pull out from each object in the list > its own Model

Re: Authenication for django.views.generic Views

2009-04-16 Thread Daniel Roseman
On Apr 16, 4:25 pm, Col Wilson wrote: > I'm using generic views to render my pages > (django.views.generic.date_based, django.views.generic.list_detail > etc) and they're very handy. > > However, the app I'm trying to build would like a security and on > reading the "User Authentication in Django

Re: Django doesn't validates CharFields before gitting the DB?

2009-04-16 Thread Daniel Roseman
On Apr 17, 5:58 am, Horacio de Oro wrote: > Hi! I've a problem with Django not validating my 'CharField's. Maybe > I'm misunderstanding the docs, and Django doesn't do this kind of > validations? > > I've made a simple example. This is the model: > > class SimpleModelC(models.Model): >     name=m

Re: Query to retrieve users from a given group

2009-04-17 Thread Daniel Roseman
On Apr 17, 1:23 pm, Bastien wrote: > Hi, > > I'm trying to retrieve a list of users belonging  to a given group but > don't understand how to do it. It must be a sort of many to many query > but I can't get it to work. > > I would like to do something like this: > > basic_users_list = User.object

Re: ..... in templates

2009-04-17 Thread Daniel Roseman
On Apr 17, 2:38 pm, 83nini <83n...@gmail.com> wrote: > I'm looking at the following code from thewww.djangobook.com: > > > Ordering notice > > > > Ordering notice > > Dear {{ person_name }}, > > Thanks for placing an order from {{ company }}. It's scheduled to > ship on {{ ship_date|date:"F j, Y

Re: don't know how to use http://docs.djangoproject.com/en/dev/howto/initial-data/

2009-04-20 Thread Daniel Roseman
On Apr 20, 8:16 pm, bconnors wrote: > How do I set up a initial_data.json file? > Athttp://docs.djangoproject.com/en/dev/howto/initial-data/ > > I came across this “Or, you can write fixtures by hand; fixtures can > be written as XML, YAML, or JSON documents. The serialization > documentation ha

Re: Search and urls

2009-04-21 Thread Daniel Roseman
On Apr 21, 1:25 pm, Oto Brglez wrote: > Hi all you coders outthere! > > I want to search for data in my database. Thats all fine. > I just need help with quetys in urls... > > I want to have link like this: > /search/q=cars > /search/q=car+red+blue > /search/q=my+search+query > > The problem is t

Re: mysite.polls: __init__() got an unexpected keyword argument 'max_length'

2009-04-22 Thread Daniel Roseman
xOn Apr 22, 7:30 pm, bconnors wrote: > I just updated django > > pubu...@pubuntu:~$ sh -x dj > + svn cohttp://code.djangoproject.com/svn/django/trunk/django-trunk > U    django-trunk/django/db/backends/oracle/creation.py > U    django-trunk/django/forms/models.py > U    django-trunk/django/contri

Re: Subclass AdminSite vs. custom admin views

2009-04-22 Thread Daniel Roseman
On Apr 22, 7:30 pm, MrJogo wrote: > Hi, > > I'm creating a website for an organization that is going to need a > complicated web admin interface. The built in one is fine for the site > administrators, but there are different staff positions that need > access to different models, and sometimes i

Re: Django turns?

2009-04-22 Thread Daniel Roseman
On Apr 22, 7:00 pm, Juanjo Conti wrote: > Hi! > > I wonder know if there is a Django app suitable to handle turns as the ones > given by a doctor to his pacients. >  Thanks in advance, > > -- > Juanjo Conti I think in English you mean 'appointments' - but I'm not aware of any app that does that.

Re: mysite.polls: __init__() got an unexpected keyword argument 'max_length'

2009-04-24 Thread Daniel Roseman
On Apr 24, 2:28 pm, bconnors wrote: > I created a djsite folder and put new django there > > pubu...@pubuntu:~/djsite/mysite$ > + svn cohttp://code.djangoproject.com/svn/django/trunk/django-trunk > Checked out revision 10630. > pubu...@pubuntu:~/djsite/mysite$ > > then did > > pubu...@pubuntu:~/d

Re: help beginner: problem with settings.py conf and urls.

2009-04-25 Thread Daniel Roseman
On Apr 25, 7:33 pm, zayatzz wrote: > Hello > > Im trying to give enough information in first post so you could help > me if you can or want to. For that reason this post might turn out bit > long. > > I found tinymce pluggable for django -http://code.google.com/p/django-tinymce/ > - and ive been

Re: List Mapping in Template?

2009-04-26 Thread Daniel Roseman
On Apr 26, 8:09 am, andrew wrote: > We know that power MTV of Django. > Here is my question. > > I have 3 list of "Thing", fruit,bread,wine, but they share a same > structure of template,I want to render them to on template like this: > > view: > fruitList = thing.objects.filter(type='1') > bread

Re: When updating a model instance, list changed fields from inside save()?

2009-04-27 Thread Daniel Roseman
On Apr 27, 10:08 am, JK Laiho wrote: > Something I don't know how to do in an elegant fashion: > > Given a model instance that already exists in the database and is > about to be updated (i.e. some columns of the DB row are changed), is > there a way for the instance's save() method to see what f

Re: UnicodeEncodeError

2009-04-28 Thread Daniel Roseman
On Apr 28, 8:00 am, liog...@gmail.com wrote: > UnicodeEncodeError at /admin/articles/article/18248/ > Yes, you have an error. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Daniel Roseman
On Apr 29, 8:06 am, Vincent wrote: > No, i did not mean this. > The situation is, i have model A and model B, B has a foreignkey point to > A,. > > now i find that i wanna delete records of A without deleting records of B > which pointing to A. > i think i could reset the B's foreignkey field to

Re: HTML Forms and Sessions - Help!

2009-04-29 Thread Daniel Roseman
On Apr 29, 10:15 am, Alfonso wrote: > Hi, > > Leading on from a post I made a few days ago I'm having real trouble > dealing with sessions to preserve form state and the standard HTML for > I placed in the template.  I can't seem to get to the session data for > the form once submitted (via GET)

Re: dynamic model field assignments

2009-04-29 Thread Daniel Roseman
On Apr 29, 12:09 pm, Dennis Schmidt wrote: > Hi Mike, > > thanks a lot but that was unfortunately not what I ment. Your > assignmements are static in > > In [2]: n = TestFun(name="mike", description="Testing is always > fun.") > > but I need them to be dynamic. So in the above case NAME wouldn't

Re: Can the admin site link foreign keys?

2009-04-29 Thread Daniel Roseman
On Apr 30, 6:11 am, Rex wrote: > Let's say I've got two models: User, and Country. Each user is from > one country, and each country has multiple users. so the User model > contains a ForeignKey for a Country object. > > Can I do either of the following through the Django admin web > interface? >

Re: Dynamic form validation doesn't work.

2009-04-30 Thread Daniel Roseman
On Apr 30, 5:43 pm, Lacrima wrote: > Hello! > > For example I have: > class ContactForm(forms.Form): >     def __init__(self, foo, *args, **kwargs): >         super(ContactForm, self).__init__(*args, **kwargs) >         self.fields['subject'] = forms.CharField() >         self.fields['message'] =

Re: how to change database within Django.

2009-04-30 Thread Daniel Roseman
On Apr 30, 6:45 pm, peter wrote: > Hello, >   I'm an newbie so please bear with me. > >   I have a simple form that a user can select the from different > product line (databases) and search based on serial number.  From what > I have read, the database name needs to be specified within Django, >

Re: Help - Adding Model String Representations

2009-05-01 Thread Daniel Roseman
On May 1, 8:00 am, gforce wrote: > Hi, > > I am having problem getting the Model String Representation working > following the Djangobook 2.0. I can save and add records no problems. > > I have > > Django (installed from svn)  (1, 1, 0, 'beta', 1) > > Mysql 5x > Python 2.5.4 > > I have followed t

Re: getting a single record

2009-05-01 Thread Daniel Roseman
On May 1, 4:59 pm, deostroll wrote: > Hi, > > Suppose if I want to edit a contact in my contact book, I am able to > initiate the appropriate command because I know the primary key value. > How do you get the data pertaining to this key value in your python > code? Ultimate aim is to load a web f

Re: A way to specify different template code for every 6th item in a list?

2009-05-02 Thread Daniel Roseman
On May 2, 7:28 am, "Chris O'Donnell" wrote: > I'm using the Blueprint CSS framework and need to be able to have > every 6th list item processed with different code than every  1st-5th. > I guess you could do some sort of "is divisible by 6" thing, but I'm > not sure exactly what's entailed to get

Re: Recursive Model Setup in Admin - Error (null, blank = True)

2009-05-02 Thread Daniel Roseman
On May 2, 8:48 am, Anthony wrote: > I'm trying to instantiate a recursive object model via the admin, but > am getting an error. > > My model: > > class Bracket(models.Model): >     m = models.ForeignKey(OtherModel) >     parent = models.ForeignKey('self', blank=True, null=True) >     name = mode

Re: Help beginner again: templatetags.

2009-05-02 Thread Daniel Roseman
On May 2, 6:52 pm, zayatzz wrote: > this must be some kind of magic, cause: > > The time is {% current_time "%Y-%m-%d %I:%M %p" %}. > > is all what my arts.html contains now. > > But i > 1) cleared firefox cache > 2) disabled caching from ff's web developer toolbar > 3) disabled firebug just in c

Re: Altering database object

2009-05-02 Thread Daniel Roseman
On May 2, 3:39 pm, Vedlen wrote: > Hi everybody, > > I started working with Django very recently and I'm basically a PHP > developer so I'm pretty much confused with lots of different things > right now as I'm getting used to Django ;) > > Here's my problem : > > First off, I fetch values from my

Re: Retrieving data from a form ChoiceField

2009-05-03 Thread Daniel Roseman
On May 3, 11:01 am, Alex Rades wrote: > Hi, > i have a simple form which among other fields has a ChoiceField with > some choices: > > CHOICES=( >   (1, u'Bar basf asdf'), >   (2, u'Asdf', qewr'), >   (3, u'Afefafafa saef3') > ) > > when i receive the form, i do all the usual procedure until i wa

Re: Altering database object

2009-05-03 Thread Daniel Roseman
On May 3, 2:24 am, Vedlen wrote: > I've got multiple tuples, and I need all the fields. > I just need to pass all the "moment" fields from the tuples, into my > function. > > Here is what my template looks like : > > > {{ for s in Score }} > {{ s.moment }}{{ s.someOtherField }} > {{ endfor }} >

Re: Overriding save method in model

2009-05-05 Thread Daniel Roseman
On May 5, 8:00 pm, Thierry wrote: > I have the following model: > > class Pet(models.Model): >     name = models.CharField(max_length=64) >     picture = models.ImageField(upload_to='/usr/django/images/') > >     def save(self, force_insert=False, force_update=False): >         // override the pi

Re: Overriding save method in model

2009-05-06 Thread Daniel Roseman
On May 5, 10:15 pm, Thierry wrote: > How can I set picture to the image extension?  I don't think > "instance.picture = ext" works: > >  def pet_picture_upload(instance, filename): >      name, ext = os.path.splitext(filename) >      instance.picture = ext >      return '/usr/django/images/%s%s'

Re: custom form problem...

2009-05-06 Thread Daniel Roseman
On May 6, 5:26 am, NicoEchániz wrote: > Hello, > > I have a model which has a ForeignKey to itself. I'm doing this to > represent a hierarchy which I then need to display in the > corresponding select field of my form. > > I've come up with a simple custom Form which represents my select > choice

Re: changing models vs update DB

2009-05-06 Thread Daniel Roseman
On May 6, 3:03 pm, Gil Sousa wrote: > Hi! > > I already read that django doesn't do an update to the DB (tables > structure) when we do the syncdb command, just create new tables if > necessary..., but how do I know which tables were created and which > ones should I do the manual update? > > Now

Re: Hidden field in Admin without label

2009-05-06 Thread Daniel Roseman
On May 6, 4:48 pm, PierreR wrote: > I don't seem to find a good way to have a hidden field in the admin > console. I can of course get the hidden field easily but the label is > still showing up. This problem is really related to the Admin app. > > I have been trying to "hack" the "fieldset.html"

Re: Hidden field in Admin without label

2009-05-07 Thread Daniel Roseman
On May 7, 9:23 am, PierreR wrote: > That is what I do ! > (another way is to define a custom model field and override the > "formfield" method). > > But ... I cannot get rid off the label in the admin console. That is > my problem. > > Any easy way to remove the label of an hidden field in the ad

Re: Need help optimizing a view, too many queries

2009-05-07 Thread Daniel Roseman
On May 7, 5:56 pm, Eric Chamberlain wrote: > Our view is taking too long to render, can anyone offer suggestions to   > improve its speed? > > There are 5830 profiles. > > Total query count: 23809 > Total duplicate query count: 493 > Total SQL execution time: 66.003 > Total Request execution time

Re: Help with Querying Related Models, Please!

2009-05-08 Thread Daniel Roseman
On May 8, 4:21 am, andre wrote: > """ > Background: > > As described on the "User Authentication in Django" manual, I am using > an additional model to store extra information about users. This > additional model (J2User) model uses a ForeignKey to the User model > and is specified below. > > Pro

Re: Need help optimizing a view, too many queries

2009-05-08 Thread Daniel Roseman
On May 8, 12:03 am, Daniel Roseman wrote: > On May 7, 5:56 pm, Eric Chamberlain wrote: > > > Our view is taking too long to render, can anyone offer suggestions to   > > improve its speed? > > > There are 5830 profiles. > > > Total query count: 23809

Re: Problem with prepopulating model form.

2009-05-09 Thread Daniel Roseman
On May 9, 1:24 pm, zayatzz wrote: > Hello > > I've been trying to figure out how to use modelforms and so far ive > managed to do things on my own. But now im trying to prepopluate > modelform and it does not work - not completely anyway. > > Model: > from django.db import models > from tinymce i

Re: "-" in template variables

2009-05-10 Thread Daniel Roseman
On May 10, 1:58 am, Danne wrote: > I'm using the Tumblr (http://www.tumblr.com) REST Api, and keys in > returned json contains the character "-", like "post": {"regular- > title": "asdf" .}. I'm having trouble printing this in the django > templates since regular-title is an invalid variable

Re: How to solve value error

2009-05-10 Thread Daniel Roseman
On May 10, 4:17 am, Nalini wrote: > Hi, > > I am getting this value error in my report. i am using pagination fro > my report. I have only 2 records in my database. so in order to check > whether my pagination works i gave > { % autopaginate Data 1 % } so that each record will get displayed in >

Re: 'base' template

2009-05-10 Thread Daniel Roseman
On May 10, 1:14 am, lisa holper wrote: > No, sorry there is a misunderstanding. I did not use Apache, but just copied > the html files in my directory of my homepage. So, this does not work? Do I > need to use Apache? > thanks again, Lisa > Again, you need to read the deployment documentation, a

Re: Field value from queryset as extra_context

2009-05-10 Thread Daniel Roseman
On May 10, 5:03 pm, Jamie Pittock wrote: > Please excuse the subject if it makes no sense. > > Simplified, I have two models Pub and Town.  Pub has a ForeignKey > field called 'town'.  I'm using the generic object_list view to > display all pubs in a particular town (based on a town slug in the >

Re: multiple application under a project and handling of tables

2009-05-10 Thread Daniel Roseman
On May 10, 10:02 pm, tekion wrote: > Hi, > Given a scenarios where you have multiple applications under a > project.  You want to manage tables associated with one application > only, for example deleting data in tables associated with one > application only. Is there a way to manage that via Dja

Re: get_or_create not atomic?

2009-05-12 Thread Daniel Roseman
On May 12, 10:04 am, Will McGugan wrote: > Hi, > > I recently tracked down a strange bug in our site where 2 object existed but > the code was expecting only one. > > I think this is due to get_or_create, which doesn't appear to be atomic. > What I assume happened is that two requests came in clo

Re: What debugger do you use?

2009-05-12 Thread Daniel Roseman
On May 11, 1:53 pm, Joshua Russo wrote: > I'm currently using Netbeans 6.5 with the Python plugin. I was just > wondering what everyone else is using because NB is a bit buggy with > the Python plugin at the moment. I've never seen the need for anything better than plain old pdb. You can insert

Re: creating objects in views

2009-05-12 Thread Daniel Roseman
On May 12, 10:51 am, Oleg Oltar wrote: > Hi! > I am running small blog-styled information site. Which contains articles > added via admin application > Now I am trying to add possibility to add comments, so I defined a comment > Model (which contains Foreign Key to article object, and few text fi

Re: refill fields of a form in case of error

2009-05-12 Thread Daniel Roseman
On May 12, 11:37 am, Miguel wrote: > Hi all, > > I have a dynamic form with lot of fields. The problem is that in case of > error, the failed field is indicated to the user but the user must rewrite > the rest of the fields. > I am sure it may be a way to post the not error fields back to the for

Re: refill fields of a form in case of error

2009-05-12 Thread Daniel Roseman
On May 12, 2:00 pm, Miguel wrote: > in case of errors in the form,  in which objects are sent back the fields > which are already filled? > > Miguel > Sent from Madrid, Spain Your original post didn't make clear that you're not using the Django forms library. If you were - and really, I highly r

Re: flatpage content not appearing

2009-05-12 Thread Daniel Roseman
On May 12, 6:13 pm, Jesse wrote: > Hello, > > I'm using tiny_mce with flatpages in the admin.  I can get the > template to appear with the extended CSS, but not the flatpage > contents of the page. > My flatpage in admin is: > URL:  / > Content:  much text that is not appearing in the template. >

Re: Tutorial help, cannot save data

2009-05-12 Thread Daniel Roseman
On May 12, 10:14 pm, "asdjohn...@gmail.com" wrote: > Hello, > > I have just started with Django a few days ago and have gone through > the tutorial but can't figure out how to save user inputed data to the > database. > > For example, in chapter 7 we learn how to collect data and use it to > send

Re: NoReverseMatch with Django-Profiles

2009-05-12 Thread Daniel Roseman
On May 12, 11:00 pm, Holger Latz wrote: > Hi, > > I included the Django-Profiles Module as recommended with > > (r'^profiles/', include('profiles.urls')), > > in my urls.py and so far it works fine. > > Now I'd like to make use of an the implemented kwarg 'success_url'. As > far as I use it wit

Re: App not found

2009-05-13 Thread Daniel Roseman
On May 13, 3:32 am, "neri...@gmail.com" wrote: > Hello, > > I'm working on my first project and for some reason I keep getting > "Error: App with label orders could not be found. Are you sure your > INSTALLED_APPS setting is correct?". I've verified this many times by > creating dummy apps and ru

Re: What debugger do you use?

2009-05-13 Thread Daniel Roseman
On May 12, 4:13 pm, Stef Mientki wrote: > On Tue, May 12, 2009 at 11:28 AM, Daniel Roseman < > > roseman.dan...@googlemail.com> wrote: > > I've never seen the need for anything better than plain old pdb. > > That you've never seen winpdb. > > cheers,

Re: Does the objects.get method automatically escape single quote?

2009-05-13 Thread Daniel Roseman
On May 13, 2:25 am, Thierry wrote: > My table has the following entry: > > id      name > 1       foo's > > I'm currently trying the following: > > value = "foo's" > > MyModel.objects.get(name = value) > > The above is raising the exception DoesNotExist.  Doesn't the get > function automatically

Re: Custom Save and calculating totals - weird behaviour

2009-05-13 Thread Daniel Roseman
On May 13, 11:28 am, Alfonso wrote: > Discovered a weird bug in my custom save method for a model.  Setup is > a simple invoice model linked to multiple invoice order models (fk to > invoice) and the invoice model holds data like total number of units > of ordered... i.e. > > Invoice order 1: > 2

Re: Form errors manipulation - autofill values in case of error

2009-05-13 Thread Daniel Roseman
On May 13, 11:59 am, Miguel wrote: > I want to generate the following info in my html: > > > > To do that I proccess the info as follows: > >                                         Peso (kg) >                                         {% ifequal fila.__str__ > metodo.get_unidad_series %} >      

Re: Form errors manipulation - autofill values in case of error

2009-05-13 Thread Daniel Roseman
On May 13, 12:47 pm, Miguel wrote: > the problem I have is that the fields are dynamic so I can not do any model > from a form django object... > > Miguel > Sent from Madrid, Spain > This doesn't follow. Forms don't have to be based on models, and it's perfectly possible to do a dynamic form. Al

Re: Seperate thread - best practices

2009-05-14 Thread Daniel Roseman
On May 14, 10:03 am, Filip Gruszczyński wrote: > > Best practice here would be to stop trying to use a webserver to do > > things it wasn't intended for. > > > If you need a separate process/thread to run regularly and perform > > some background processing, then put that code in a standalone scr

Re: creating objects in views

2009-05-14 Thread Daniel Roseman
On May 14, 5:59 pm, Oleg Oltar wrote: > Well, the problem with built in comments framework is that I need few more > fields in comments. > > What I created is: > > MODEL: > > class Comment(models.Model): >     name = models.CharField(max_length = 30) >     body = models.CharField(max_length = 200

Re: disable django cache

2009-05-14 Thread Daniel Roseman
On May 14, 8:19 pm, online wrote: > Hi all, > > I have a small project still under development. I don't set any cache > stuff yet. But for somehow django still cache all web pages. > > Why django default uses cache?  How can i disable the all level > caches? > > I tried > > from django.views.deco

Re: disable django cache

2009-05-15 Thread Daniel Roseman
On May 15, 4:14 am, online wrote: > Thanks, this kind of design is interesting, not what i expected > though. > > I thought the server is running whatever my script i want to use >     return render_to_response('home.html') > or >     return render_to_response('index.html') When you change conte

Re: writing a view for an ajax funtion in a template

2009-05-15 Thread Daniel Roseman
On May 15, 12:14 pm, newbie wrote: > Hi, > >          i'm new to both ajax and django. Can some1 explain me how to > write a view function for an ajax functionality in a template. For > example, I've registered a ajax event in a template and wanted to send > some information to a function in a vi

Re: writing a view for an ajax funtion in a template

2009-05-15 Thread Daniel Roseman
On 2009/5/15, newbie wrote: > hi, > > Thanks for the reply. > > So suppose i call the ajax function like this. > > var args = { type:"POST", url:"district", > data:data, complete:done }; >$.ajax(args); > > where data is the data to be posted a

Re: displaying image in a template

2009-05-16 Thread Daniel Roseman
On May 16, 7:37 pm, newbie wrote: > Hi, > >          I want to display an image from static files directory in a > template. The name of the image is stored in a variable(say image). > When i try to display it in the template using img tag( src = > {{ image }} ), its not displayed. Can someone he

Re: Form trouble

2009-05-16 Thread Daniel Roseman
On May 16, 10:51 pm, Alex Gaynor wrote: > On Sat, May 16, 2009 at 4:49 PM, zayatzz wrote: > > > Hello > > > Been trying to figure out where the problem is, but its almost 1am and > > im out of ideas. > > > i have this model: > > class tuser (models.Model): > >        username = models.CharField(

Re: Integer Max/Min Values

2009-05-16 Thread Daniel Roseman
On May 16, 11:32 pm, ajohnsen wrote: > Hello, > > I am trying to assign max_value and min_value to a > PositiveIntegerField in my model but am getting the error: > > year_built = models.PositiveIntegerField(min_value=1800, > max_value=2100) > TypeError: __init__() got an unexpected keyword argume

Re: displaying image in a template

2009-05-16 Thread Daniel Roseman
On May 16, 9:19 pm, newbie wrote: > Hi, > >          Thanks for your immediate  reply. I've seen the document and > followed the steps in it already. But was not able achieve any > progress. In > > (r'^site_media/(?P.*)$', 'django.views.static.serve', > {'document_root': '/path/to/media'}), > > d

Re: Help on query

2009-05-19 Thread Daniel Roseman
On May 19, 12:11 pm, Lokesh wrote: > class Users(models.Model): >     userId = models.IntegerField(max_length=2, primary_key=True) >     userName = models.CharField(max_length=10, null=False, > blank=False) > >     def __unicode__(self): >         return self.userName > > class MotherTongue(model

Re: Error in basic template in admin

2009-05-20 Thread Daniel Roseman
On May 20, 6:33 am, Diogo Baeder wrote: > Hi, guys, > > I'm having an issue with the basic admin template at my project... > basically, it says that it doesn't see an "urls" module, in a line that > tries to include links to the admin documentation, but I've not > activated the documentation! :-(

Re: need help for using counter inside for loop

2009-05-20 Thread Daniel Roseman
On May 20, 9:01 am, google torp wrote: > > Hi, > > > Hi, > > > my_date_list = ['01', '02', > > '03','04','05','06','07','08','09','10','11','12','13','14','15','16','17', > > '18','19','20','21','22','23','24','25','26','27','28','29','30','31'] > > str_date_list=[] > > for item in my_date_list

Re: UnicodeEncodeError

2009-05-20 Thread Daniel Roseman
On May 20, 11:56 pm, Sean Brant wrote: > Traceback (most recent call last): >   File "manage.py", line 11, in ? >     execute_manager(settings) >   File "/home/58124/data/python/django/django/core/management/ > __init__.py", line 362, in execute_manager >     utility.execute() >   File "/home/581

Re: Models with behavior

2009-05-22 Thread Daniel Roseman
On May 22, 6:19 am, vishy wrote: > Hi, > > I have some functionality which needs to be part of a class,which I > don't want to persist in database.Where should I put such a class? In > models.py? You can put it anywhere on your pythonpath. If it's related to a single application, you might try t

Re: Backwards foreign key relations in listings

2009-05-22 Thread Daniel Roseman
On May 22, 11:28 am, akaariai wrote: > Hi all, > > I am trying to find a best way to solve the following problem: > > I have chemicals, each of which has a list of codes and names. > Chemicals have too many codes and names to put directly into the > Chemical model. > > Example (pseudo) models.py:

Re: Accessing session variables in template with django

2009-05-23 Thread Daniel Roseman
On May 23, 6:34 am, Puneet wrote: > Hi All, > > I am facing issue when I am trying to access session variables in > django. > > I am setting the session variable something like : > >  request.session['cityname'] = cityname >  c = RequestContext(request, {'current_date': now}) >  html = t.render(c

Re: Why does form.is_valid() throw ValueError?

2009-05-23 Thread Daniel Roseman
On May 23, 5:07 am, Rex wrote: > On May 22, 4:33 pm, "R. Gorman" wrote: > > > You are correct in your understand that .is_valid() returns False if > > the data is invalid. Are you sure you are not processing data > > irrespective of whether the data validated or not? A little more > > detail on

Re: How to create a QuerySet from raw SQL query?

2009-05-23 Thread Daniel Roseman
On May 23, 9:35 am, wierob83 wrote: > Hi, > > how can I obtain a QuerySet from a raw SQL query? > > I want to use some generic views (objects list, object detail). > Unfortunately, all examples I've seen require a QuerySet (e.g. > MyModel.objects.all()). I'm using an existing database and already

Re: Why file path and name disappear for Image Field when/after validation

2009-05-23 Thread Daniel Roseman
On May 23, 12:27 pm, Stephen Cheng wrote: > I suppose that all the fields' value in the form defined in model can > be captured and remained when/after you do form validation. My problem > is that : > > 1. When the form is not valid, the filename of image field is gone > once you click submit or

Re: global name 'request' is not defined

2009-05-23 Thread Daniel Roseman
On May 23, 2:07 pm, Bobby Roberts wrote: > from django import forms > from tinymce.widgets import TinyMCE > > def GetRequestId(request): >     curpath=request.path >     return curpath > > Hi all.  I have  a simple function i'm tryin to implement in my > forms.py file.  The intent is to get the c

Re: global name 'request' is not defined

2009-05-23 Thread Daniel Roseman
On May 23, 2:33 pm, Bobby Roberts wrote: > > The code you have given is incapable of producing that error - request > > is passed as a parameter, so will always be defined within the > > function. Are you sure the error is coming from within the function? > > Give us the actual traceback that is

Re: How to use filtering

2009-05-25 Thread Daniel Roseman
On May 25, 8:08 am, Oleg Oltar wrote: > Hi! > > I am trying to understand how to use filters in django. > > I have following models: > > class Section(models.Model): >     section = models.CharField(max_length=200, unique=True) >     name = models.CharField(max_length=200, blank = True) >     cat

Re: ifequal tag within nested for: html forms

2009-05-25 Thread Daniel Roseman
On May 25, 2:29 pm, Pablo López wrote: >                         {% ifequal str(problemImpact.description) > (impact.0) %} This is not valid Django template syntax - I am surprised it works at all. You can't call functions with parameters within Django templates. -- DR. --~--~-~--~~

Re: prepopulate file fields in forms after validation errors

2009-05-26 Thread Daniel Roseman
On May 26, 12:30 pm, Bastien wrote: > Hi, > > When I have some validation errors in my forms they automatically get > reloaded after POST with all the fields already filled with what the > user already introduced before POST and she only has to change > whatever was wrong in the first place. But

Re: Getting list of objects with objects that has foreign key to it

2009-05-26 Thread Daniel Roseman
On May 26, 3:08 pm, Joshua Partogi wrote: > Hi all, > > I have a very trivial case that somebody might have solved before, but I can > not get my head around. > > I have this two objects that is related to each other: > > > class Product(models.Model): >     name = models.CharField(max_lengt

Re: why no modelformset from a modelform?

2009-05-27 Thread Daniel Roseman
On May 27, 9:55 am, nbv4 wrote: > I have a model which has about 4 fields. One of those fields is a > foreign key to another model which has over 40,000 objects in the > database. When I create a 'stock' ModelForm of this model, and display > it in a template, it wants to create a with 40,000 it

Re: How to include parent name in list of children?

2009-05-27 Thread Daniel Roseman
On May 27, 2:59 pm, Tom Evans wrote: > On Wed, 2009-05-27 at 06:27 -0700, adelaide_mike wrote: > > Very beginner here. > > > My model has two classes, Suburb, the parent, and Street, the child: > > > class      Suburb(models.Model): > >            suburb_name = models.CharField(max_length=72) > >

Re: comma seperated lists

2009-05-29 Thread Daniel Roseman
On May 29, 6:15 am, Brian May wrote: > On Thu, May 28, 2009 at 11:36:10PM -0500, Alex Gaynor wrote: > > Loops put some vary helpful variables in the context, so you can do > > something like: > > > {% for pp in object.photoperson_set.all %}{{pp.person}}{% if not forloop.last %}, > > {% endif %} {

Re: What's wrong with this code?

2009-05-31 Thread Daniel Roseman
On May 31, 9:56 am, andrew_dunn wrote: > I'm trying to run a script to import data to my model. All the field > names are correct. What I'm getting is an error message that says my > syntax is incorrect on the line that says "for row in reader:" It says > the error is on the colon. If I remove th

Re: Question about ForeignKeys and subclasses

2009-05-31 Thread Daniel Roseman
On Jun 1, 5:39 am, Rex wrote: > Hello, > > I have a question that is best illustrated by the following fictional > example. (I put my question at the end.) > > #= > # In models.py > class Room(models.Model): >     animal = models.ForeignKey(Animal) > > class Animal(models.Model): >     #[

<    2   3   4   5   6   7   8   9   10   11   >