new Django-Python can't get to sqlite

2010-08-12 Thread Tom
It's my first time using Django & I'm unable to get the demo going. I would like to use sqlite (ultimately mysql). Python 2.7 installed ok. Then I installed (I think) Django 1.2.1. The "manage.py runserver" works, but the "syncdb" fails. How do I "install" sqlite or pysqlite2 (or even mysql)? I

Re: Many to many fields to string

2010-08-12 Thread Steve Holden
On 8/12/2010 8:11 PM, Wendy wrote: > Thanks so much both of you, totally works and makes sense. I used > Joseph's version because of the commas, but they both helped me > understand what was happening. > I notice that it seems to be ok to put the if statement on one line: > > {% if

Re: Many to many fields to string

2010-08-12 Thread Wendy
Thanks so much both of you, totally works and makes sense. I used Joseph's version because of the commas, but they both helped me understand what was happening. I notice that it seems to be ok to put the if statement on one line: {% if filmmakers|length > 2 and not forloop.first %}, {% endif %}

Save_model versus model.save() and the order they are called.

2010-08-12 Thread vjimw
We have a model object (Offer) which has a number of business rules. 1) On create, auto populate the created_by field with the request.user data 2) On modify, auto populate the last_edited_by field with the request.user data 3) If a date value change on modify, audit with the object, date and

Re: confusing query involving time ranges

2010-08-12 Thread Paulo Almeida
Can you sequentially add the states for each foo? I'm thinking of something like: states = [] for foo in foos: foo_state = State.objects.filter(foo=foo, first_dt__lte=dt, last_dt__gte=dt) if foo_state: states.append(foo_state) else: states =

Non-file translations backend?

2010-08-12 Thread Daniel Abel
Hi! Is there a way to store translation strings (that are used by, for example, ugettext_lazy) in the database as opposed to some file? I know about the translation apps listed on http://www.muhuk.com/2010/01/dynamic-translation-apps-for-django/ and I am thinking not about translating stuff in

reading pickled files cont.

2010-08-12 Thread Tony
I just realized it said the error occurred here: /home/opadmin/webapps/django/lib/python2.6/django/http/__init__.py in _get_content, line 395 So I guess dJANGO has something to do with it -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

reading pickled files

2010-08-12 Thread Tony
This is more of a python question but its in my Django project. I am reading a unicode object and an integer from a database into a dictionnary and storing that in a pickled file. Ive confirmed the dictionary is done correctly because i print it out from the pickled file later to check. I also

Re: issues with form error in custom templates not displaying correctly

2010-08-12 Thread cootetom
You would use CSS for styling. li { border:1px solid #FF; } You might want to create a class for error styling though! On Aug 12, 4:44 pm, reduxdj wrote: > Hi, > > I can't seem to get my form errors to work with customs forms in > django, following the examples

Re: confusing query involving time ranges

2010-08-12 Thread Alec Shaner
Hopefully some django sql guru will give you a better answer, but I'll take a stab at it. What you describe does sound pretty tricky. Is this something that has to be done in a single query statement? If you just need to build a list of objects you could do it in steps, e.g.: # Get all State

Re: limit a view for an ip address only

2010-08-12 Thread vikalp sahni
using request.META['REMOTE_ADDR'] and the passing ur request through custom middleware might solve your problem Ex: You can have a standard user let say "internal" which you can put into your request if it comes from internal IP inside middleware. from django.contrib.auth import login,

Re: Problem with dumpdata and loaddata in python format

2010-08-12 Thread Shawn Milochik
Good question. According to the dumpdata docs, the available formats are here: http://docs.djangoproject.com/en/1.2/topics/serialization/#serialization-formats And 'python' does indeed show in that list. However, that page does mention that the 'python' version serves as a base for other formats

limit a view for an ip address only

2010-08-12 Thread Alessandro Ronchi
I want to limit a django view to be accessible for staff users or free (without autentication) for a single ip. Is it possible? -- Alessandro Ronchi http://www.soasi.com Hobby & Giochi http://hobbygiochi.com http://www.facebook.com/hobbygiochi -- You received this message because you are

Re: Custom Inline Formset Validation

2010-08-12 Thread kkerbel
To clarify, by "checked" I mean there is a booleanfield and I only want to let the user select 5 of those at a time across the inline formset. On Aug 12, 1:14 pm, kkerbel wrote: > I'm trying to do some custom validation for an inlineformset.  I would > like to only allow 5

Custom Inline Formset Validation

2010-08-12 Thread kkerbel
I'm trying to do some custom validation for an inlineformset. I would like to only allow 5 items checked across the forms in the inline formset. What's the best way to do this? I have tried defining a method (like a clean method for forms and formsets) but it doesn't appear to work. Maybe I'm

Re: Different Django instances running on the same server

2010-08-12 Thread CLIFFORD ILKAY
On 08/12/2010 12:18 PM, Rick Caudill wrote: Hi, Is it possible to run Django 1.1 and Django 1.2 on the same server? I have some legacy apps that I need to port to 1.2 but until then I would still like to run 1.1 and also at the same time run 1.2 for some new apps. Is this possible If

Overriding the widget of a custom form field in admin

2010-08-12 Thread omat
Hi All, I have a custom TagField form field. class TagField(forms.CharField): def __init__(self, *args, **kwargs): super(TagField, self).__init__(*args, **kwargs) self.widget = forms.TextInput(attrs={'class':'tag_field'}) As seen above, it uses a TextInput form field widget.

Re: dynamic forms and custom methods

2010-08-12 Thread Nick
I think jquery may be the right way to go for this. It will allow you to evaluate the weights in real time so you won't have to submit the form before any validation errors would be returned. Working it at the model level may get tricky, for ease I would handle it at the form or view level. On

confusing query involving time ranges

2010-08-12 Thread Emily Rodgers
Hi, I am a bit stuck on this and can't seem to figure out what to do. I have a model that (stripped down for this question) looks a bit like this: class State(models.Model): first_dt = models.DateTimeField(null=True) last_dt = models.DateTimeField(null=True) foo =

Encoding with {% url %} tag

2010-08-12 Thread aa56280
I'm using the url tag like so: {% url app.views.blah var1, var2 %} var1 and var2 need to be encoded, using the iriencode filter, so I tried this: {% url app.views.blah var1|iriencode, var2|iriencode %} That doesn't do anything though. I can't find any examples anywhere to figure this out. Any

Different Django instances running on the same server

2010-08-12 Thread Rick Caudill
Hi, Is it possible to run Django 1.1 and Django 1.2 on the same server? I have some legacy apps that I need to port to 1.2 but until then I would still like to run 1.1 and also at the same time run 1.2 for some new apps. Is this possible -- Rick Caudill -- You received this message

issues with form error in custom templates not displaying correctly

2010-08-12 Thread reduxdj
Hi, I can't seem to get my form errors to work with customs forms in django, following the examples I have done this: Price {% if form.price.errors %}

Re: stream (large) files from the back-end via Django to the user?

2010-08-12 Thread shi shaozhong
We have problems with programmatically retrieve very large datasets from an online source. It takes about 20 minutes. Therefore, efficient solutions are required. Regards. David On 12 August 2010 16:21, vjimw wrote: > When we upload files to the CDN, we store that

Re: stream (large) files from the back-end via Django to the user?

2010-08-12 Thread vjimw
When we upload files to the CDN, we store that path with the object. Then we override the widget for the file so we can server the file directly from the CDN using that field. Would that work for you? On Aug 12, 7:54 am, shi shaozhong wrote: > Dear Markus, > > This is a

Re: Encoded uploaded WAVE or AIFF file to MP3 format on server

2010-08-12 Thread VWAllen
This is just a thought, but you could separate the file encoding and storage from your model and hand that off to a Celery task. Off the top of my head: - use a "file path" charfield and a "is ready" boolean field in your model - use a FileField in your form - when the form/upload are validated,

No exception when there's problems with CACHE_BACKEND?

2010-08-12 Thread julianb
Hi, I just discovered that my memcached deamon died and apparently Django does not throw exceptions when something is wrong with the cache backend. Is that correct and should it be that way? Not even with DEBUG=True there's any information if my cache is working or if I e.g. just made a typo in

Re: dynamic forms and custom methods

2010-08-12 Thread Steve Holden
On 8/12/2010 8:36 AM, lingrlongr wrote: > Hi Nick, > > Thanks for the reply. Yes, the department weights will be used in a > grading scheme. One department may be 25% (0.25), etc... But in the > end, the weights should total 1.0. For example, in my Store model: > > class Store(models.Model):

Re: High memory consumption when going through all records

2010-08-12 Thread Tomas Kouba
On 08/12/2010 03:32 PM, Jani Tiainen wrote: >> Hello all, >> >> I have a django application for analysis of accounting information in >> torque batch system. The job is an object connected to several accounting >> event objects: >> >> class Job(models.Model): >> jobid =

Re: High memory consumption when going through all records

2010-08-12 Thread Jani Tiainen
> Hello all, > > I have a django application for analysis of accounting information in > torque batch system. The job is an object connected to several accounting > event objects: > > class Job(models.Model): > jobid = models.CharField(max_length=16, db_index=True, editable=False) >

High memory consumption when going through all records

2010-08-12 Thread Tomas Kouba
Hello all, I have a django application for analysis of accounting information in torque batch system. The job is an object connected to several accounting event objects: class Job(models.Model): jobid = models.CharField(max_length=16, db_index=True, editable=False) server =

Re: stream (large) files from the back-end via Django to the user?

2010-08-12 Thread shi shaozhong
Dear Markus, This is a very interesting topic. Please keep me informed of answers. Regards. David On 11 August 2010 15:26, Markus wrote: > Hi, > > it was hard to find the right subject. Let me explain what I want to > do. > > I write a web application with Django.

Re: dynamic forms and custom methods

2010-08-12 Thread lingrlongr
Hi Nick, Thanks for the reply. Yes, the department weights will be used in a grading scheme. One department may be 25% (0.25), etc... But in the end, the weights should total 1.0. For example, in my Store model: class Store(models.Model): #...etc... def _get_total_dept_weight(self):

Re: Reporting Library??

2010-08-12 Thread Kenneth Gonsalves
On Thu, 2010-08-12 at 14:06 +0300, Jani Tiainen wrote: > > My only option at this time is JasperReports which is java based > which > > would be an overkill. > > There is nothing as comprehensive as JasperReports, but Geraldo > reports is > pretty nice . Built on

Re: Reporting Library??

2010-08-12 Thread Jani Tiainen
> I need a reporting library for web based (HTML) reporting with support > for standard features > 1) header > 2) footer > 3) pagination > 4) Totals/summary > > > Reportlab is too low level for my needs and their pro version license > does not work for me. > > Is there any other good python

Encoded uploaded WAVE or AIFF file to MP3 format on server

2010-08-12 Thread Braddikins
Hello, I wish the user to be able to upload an MP3, WAVE, or AIFF file via POST. If the file is a WAVE or AIFF file, it is encoded to an MP3 by the server first. At the moment I have a model with a FileField to store the sound file. I am testing it through the admin interface. I have Python

Re: Image and thumbnal solution

2010-08-12 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 9:40 PM, Franklin Einspruch wrote: > I still don't get this. Are you supposed to do something like... > > image = models.ImageField() > image.height_field = 'height' > image.width_field = 'width' > > And make 'height' and 'width' columns in

Re: pyfacebook

2010-08-12 Thread Aljoša Mohorović
On Thu, Aug 12, 2010 at 1:34 AM, Alessandro Ronchi wrote: > Is pyfacebook compatible with django 1.2.1? I didn't find nothing, and > it gives me a 403 error I cannot understand: pyfacebook is no longer actively developed, try http://github.com/facebook/python-sdk

Re: MySQL-Python and Python 2.7

2010-08-12 Thread Sithembewena Lloyd Dube
Furthermore, I found this in the Django documentation... Being a Python Web framework, Django requires Python. It works with any Python version from 2.4 to 2.7..." On Thu, Aug 12, 2010 at 9:48 AM, Sithembewena Lloyd Dube wrote: > Thanks, issue solved: I found the Python 2.6

Re: How long do objects live?

2010-08-12 Thread Daniel Roseman
On Aug 12, 2:24 am, Andy wrote: > When I create an object in Django, how long does it live? > > When Django finishes responding to a HTTP request, the Python process > lives on to serve the next request. Does that mean all those objects > that were created would continue

Re: MySQL-Python and Python 2.7

2010-08-12 Thread Sithembewena Lloyd Dube
Thanks, issue solved: I found the Python 2.6 binaries. On Thu, Aug 12, 2010 at 1:58 AM, Steve Holden wrote: > Remember, though, that when Django 1.2 was released the current Python > was 2.6. There's not much the Django developers can do to hold up > progress on Python. > >

Moodle and Django - access to Moodle databases

2010-08-12 Thread jfine
Hi Anyone here interested in Moodle (the leading open source virtual learning environment, with a vibrant community and written in PHP)? I've just started a project, whose goal is to give Django access to Moodle databases. You can see it at http://bitbucket.org/jfine/django-moodle/ A