Subcategory field is not saving Stackline issue

2008-12-26 Thread Praveen
Hi all i am not able to save the entry of sub_cat field here is my model.py class MainCategory(models.Model): main_cat_code= models.CharField(max_length=20,primary_key=True) description = models.CharField(max_length = 50,) def __unicode__(self): return self.main_cat_code class SubCa

Re: django deserialize and save new model object from xml

2008-12-26 Thread Russell Keith-Magee
On Wed, Dec 24, 2008 at 6:33 AM, dick...@gmail.com wrote: > > looking at the serialization serializers, is is possible to save "new" > instance of a model object represented in xml? > > i'm getting an error: > > node is missing the 'pk' attribute, but basically, there > isn't one, because i don'

Re: How to implement code that runs in the background?

2008-12-26 Thread Alex Koshelev
Use cron and custom manage.py commands On Fri, Dec 26, 2008 at 10:58 AM, Fluoborate wrote: > > I have a philosophical question. How should I implement code that runs > in the background, automatically, and continuously? What is a safe and > kosher way to do that? > > > --~--~-~--~~

Re: Fastest way to import datas into a database

2008-12-26 Thread Russell Keith-Magee
On Thu, Dec 25, 2008 at 9:02 AM, bsergean wrote: > > Hi all, > > I'm populating my database manually using a script that create ORM > objects and save them... I have a lot of datas and it's fairly slow. > I'm wondering what is the best way to speed this up. > > From > http://docs.djangoproject.c

Re: Is there any possibility that one project connect with more than one databases?

2008-12-26 Thread Russell Keith-Magee
On Thu, Dec 25, 2008 at 5:41 PM, David wrote: > > Dear all, > > I am a newbie in Django and python, now trying to construct a website > with more than one databases on the backend. > > My question here is, if there any possibility that using 2 different > databases inside one project(website)? >

register problem

2008-12-26 Thread vierda
Dear all, I'm trying to make register page, but it it cannot compare 2 password, even if I submit different password it still run and didn't raise ValidationError, please help me. My forms.py as per below: class RegistrationForm(forms.Form): username = forms.RegexField(label=("Username"), max_

Re: PDF creation!!!

2008-12-26 Thread Marek Kubica
On Fri, 19 Dec 2008 08:21:51 -0500, Abdel Bolanos Martinez wrote: > Please can any one give me good references about tools for create PDF > reports, graphs in Django besides RepoLab I am using pdfLaTeX to generate the PDFs on the fly and serve them via Django after dumping ReportLab. regards,

Re: no module named _sqlite3 on Mac OS X

2008-12-26 Thread Rick Dooling
That did it! Thanks. I also needed zlib, I think? Rick On Dec 25, 1:15 pm, Jarek Zgoda wrote: > Wiadomość napisana w dniu 2008-12-25, o godz. 13:50, przez Rick Dooling: > > > django.core.exceptions.ImproperlyConfigured: Error loading sqlite3 > > module: No module named _sqlite3 > > > I'm runn

shooting blanks

2008-12-26 Thread Rick Dooling
I'm trying to use Django to manage an existing sqlite3 database of quotations. I used inspectdb to generate the models. Everything works fine, until I attempted my first generic view and first template. Everything executes according to plan, but I get no data outputted into the fields using obj

Re: Django form HTML is rendered as TEXT

2008-12-26 Thread shreyas k
Hi Eric Thanks a lot .i wraped the template in the autoescape tag, Now its working fine Thanks & Regards Dmitri On Fri, Dec 26, 2008 at 2:55 PM, Eric Abrahamsen wrote: > > > On Dec 26, 2008, at 10:56 AM, s4shre...@gmail.com wrote: > >> >> Hi Guys, >> I am new to Django . My Django form HTML is

Re: shooting blanks

2008-12-26 Thread Rick Dooling
Duh! Never mind. Sorry for the trouble. Simple Python goof. >{% for quotes in object_list %} > {{ table1.source2 }} Should be {{ quotes.source2 }} Sorry for the intrusion. RD On Dec 26, 10:43 am, Rick Dooling wrote: > I'm trying to use Django to manage an existing sqlite3 datab

Traceback in the ``runserver`` console

2008-12-26 Thread Fridrik Mar Jonsson
Hi Djangonians, I recently had an instance where it would have been really convenient to see the error and a traceback in the ``runserver`` console instead of just a single line telling me that the request returned a 500 error. In the event of blind debugging, where a 3rd party tool is performin

front facing poll form issues

2008-12-26 Thread Kevin
I'd like to create a front facing poll creation form that can automatically handle deletion, reordering of choices. I believe formsets are the easiest way to accomplish this. I start with 3 choices and want to allow the user to add more. Check the following code: def create(request): n

sql translation error in django?

2008-12-26 Thread 夏恺
Hi all! I'm working on an app which has two classes: # This one records acedemic journal name and related infomation: class Journals(models.Model): Name = models.CharField(u'Journal', max_length=200, unique=True) IsSelected = models.BooleanField(u'If it is a special journal', def

Re: PDF creation!!!

2008-12-26 Thread Matias Surdi
I do the reports in HTML, using django templates and then instead of send the rendered result to the browser, I filter it throught htmldoc linux utility. Works like a charm for me. Abdel Bolanos Martinez wrote: > Please can any one give me good references about tools for create PDF > reports

Re: sql translation error in django?

2008-12-26 Thread Alex Koshelev
Paper.objects.filter(Journal__Name='Science').order_by("-PublishedDate") Read the documentation please. On Fri, Dec 26, 2008 at 8:43 PM, 夏恺 wrote: > > Hi all! > > I'm working on an app which has two classes: > > # This one records acedemic journal name and related infomation: > class Journals(

python 3.0

2008-12-26 Thread waltbrad
How much of django's code is broken with python 3.0? I'm not that deep into Python, (yet). So, it strikes me that maybe I'm better off installing 3.0 and learning that rather than sticking to 2.5. But, I don't want to find out I have to go and relearn django all over again. --~--~-~--~-

Re: sql translation error in django?

2008-12-26 Thread 夏恺
Alex Koshelev 写道: > Paper.objects.filter(Journal__Name='Science').order_by("-PublishedDate") > > Read the documentation please. > > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: python 3.0

2008-12-26 Thread James Bennett
On Fri, Dec 26, 2008 at 3:15 PM, waltbrad wrote: > How much of django's code is broken with python 3.0? The installation instructions and the installation FAQ cover this issue: http://docs.djangoproject.com/en/dev/intro/install/#install-python http://docs.djangoproject.com/en/dev/faq/install/#

Dynamic model field

2008-12-26 Thread eldonp2
I'm writing a library app - would like to find out if it is possible to have a dynamically updating (returndate) field in a model? class Loan... ... borrowdate = models.DateTimeField(auto_now_add = True) returndate = models.DateTimeField(timediff(borrowdate+ timedelta (days=2)) ... --~--~--

Calculate and store the average rating

2008-12-26 Thread eldonp2
Is there a way to calculate and store the average rating in this example: RATING_CHOICES = { '3' : 'Excellent', '2' : 'Good', '1' : 'Poor', } class Loan( ... book = models.ForeignKey(Book) rating = models.IntegerField(choices=RATING_CHOICES) ... class BookRatings(... ... book = mod

Re: shooting blanks

2008-12-26 Thread eldonp2
Lol. Just looking at the time between posts - did it really take 45 min to figure that out? I find it amazing as I often lose days like that! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Pagination Suggestions

2008-12-26 Thread Dana
I highly recommend: http://code.google.com/p/django-pagination/ Very easy to implement, requires no modifications to views or models, purely template based (via template tags). On Dec 24, 2:36 pm, kev wrote: > Ah ok :) > > Thx!! > > On Dec 24, 5:12 pm, Brian Neal wrote: > > > On Dec 24, 3:54 

Getting value of field from form.

2008-12-26 Thread evenrik
So I need to display the data for a form field from the post or from the instance if no post. This works but I am hoping there is a better way: {% if form.is_bound %} {{ form.data.foo }} {% else %} {{ form.instance.foo }} {% endif %} Any suggestions? --~--~-~--~~

Re: In URL dispatcher, is there a way to pass values of Named Groups directly to template?

2008-12-26 Thread DimebagBorgir
I hope you meant "guys", heh. On Nov 6, 3:12 am, "yuanyun.ken" wrote: > Thanks for all gays' great help. This does help me a lot. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: cross table querying

2008-12-26 Thread Shuge Lee
thanks On Dec 21, 11:44 am, Malcolm Tredinnick wrote: > On Fri, 2008-12-19 at 19:58 -0800,Shuge Leewrote: > > [...] > > It's not really necessary to post all that SQL and Python, since you're > only really asking about a couple of the models. If you can reduce your > example to the smallest case

cross table querying II

2008-12-26 Thread Shuge Lee
class tb1( models.Model ): name = models.CharField(max_length=32) tb2 = models.ForeignKey(Category) class tb2( models.Model ): name = models.CharField(max_length=64) Do I have to use Manager when do cross-table querying such SELECT tb1.name, tb2.name as tb2_name FROM tb1 I

Re: cross table querying II

2008-12-26 Thread Alex Koshelev
tb1.objects.extra(select={"tb2_name": "app_tb2.name"},where=["app_tb1.name= app_tb2.name"], tables=["app_tb2"]).values("name", "tb2_name") On Sat, Dec 27, 2008 at 7:16 AM, Shuge Lee wrote: > > class tb1( models.Model ): >name = models.CharField(max_length=32) >tb2 = models.ForeignKey(Cat

Re: Calculate and store the average rating

2008-12-26 Thread Dave Dash
Hmm... this is slightly different... is BookRatings and Books 1 to 1? If I store these aggregates as part of the class that it's grouping by. Here's how I do it for restaurants: class RestaurantRating(models.Model): restaurant = models.ForeignKey(Restaurant) value = models.IntegerF

Re: How should I handle dynamically generated images?

2008-12-26 Thread Dave Dash
I currently serve up images via the DB vs. filesystem. I did this in order to keep the data in one place, but I now regret it. I'd recommend overriding the delete() of your image class to take care of deleting the related image from your storage. Depending on your needs and the amount of data,

How do I make Django evaluate a ForeignKey for json serialization?

2008-12-26 Thread adambossy
I have a model that refers to a ForeignKey, e.g.: class Template(models.Model): type = models.ForeignKey(Type) ... class Type(models.Model) name = models.CharField(max_length=32) ... I can fetch these objects fine using the model API. t = Template.objects.get(id=1) print t.type >> print t

Re: Overrding queryset on a field in form generated with ModelForm

2008-12-26 Thread Tony Chu
Thank you very much Malcolm. The methods I listed above has worked for me so far - so your response is reassuring. I was just surprised that no one had encountered a similar need already. The concept here is parallel to getting a list of territories in a country, dynamically fetched based on the