django

Satchmo: enhancing custom product module to enable file upload

Hi, I am using the Django-based e-commerce framework Satchmo. I need to make an enhancement to the store, so that the custom product module can accept file upload as one of the order inputs. I have been able to display the file upload input through the right template; I would like to know what minimum change should be done to the cart h...

Django Forms validation error - TypeError 'str' object is not callable

so...i've been banging my head on this for a bit. I'm getting the most bizarre error when attempting to validate a form. I pass input to the form wanting to test behavior when the form fails validation, i.e. i expect it to fail validation. i've got this code for a form: class CTAForm(forms.Form): first_name = forms.CharField(...

Django, queryset to return manytomany of self

Following regular manytomany queryset logic gives me errors. I guess since its related to self, I might need to do some extra magic, but i can't figure out what magic. model: class Entry(models.Model): title = models.CharField(max_length=100, verbose_name='title') related = models.ManyToManyField('self', related_name=...

django foreign key save

Hello, I have models for eg like this. class Mp3(models.Model): title=models.CharField(max_length=30) artist=models.ForeignKey('Artist') and Here is how the Artist models looks like: class Artist(models.Model): name=models.CharField(max_length=100,default="Unknown") I have created Artist with id 1. How I can create a mp...

How to serve up dynamic content via django and php on same domain?

I just finished rewriting a significant portion of my web site using python's django, but I also have some legacy code in php that I haven't finished migrating over yet. Is it possible to get these two working on the same domain and if so, how do I go about doing it? I'm running this site on a virtual Ubuntu instance and serving content...

Django: Return 'None' from OneToOneField if related object doesn't exist?

I've got a Django class like this: class Breakfast(m.Model): # egg = m.OneToOneField(Egg) ... class Egg(m.Model): breakfast = m.OneToOneField(Breakfast, related_name="egg") Is it possible to have breakfast.egg == None if there is no Egg related to the Breakfast? Edit: Forgot to mention: I'd rather not change the related_...

Session based method to track online users in django

Hello guys, apparently, the recommended way to get the number of online users in django is via what's suggested on this link: http://magicpc.wordpress.com/2009/09/22/get-online-users-in-django/ Yet, many users just like to browse my website, and I want to count them in the online users. Is it possible to do it by sessions or something...

Reading files in GAE using python

Hello all! I created a simple python project that serves up a couple of pages. I'm using the 'webapp' framework and django. What I'm trying to do is use one template file, and load 'content files' that contain the actual page text. When I try to read the content files using os.open, I get the following error: pageContent = os.open(pag...

Using django-syncr with twitter

I wanted to add twitter feed to my application. So I've downloaded python-twitter (with python-oauth) and django-syncr. Installed everything and what now ? In my main view I wanted to perform Twitter synchronisation. So looking into packages source and documentation I've figured this order : t = TwitterSyncr('name', 'pass') #: create Tw...

Django: Model Inheritance: FK & M2M

I dam trying to do this: http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name Using this style This is saved as common/abstract.py class OtherModel(models.Model): something = Charfield(max_length=100) class Meta: abstract = True class Base(models.Model): fk_model = models.Fo...

Problem with Prototype Ajax.Request in Internet Explorer 8 prompting file download

Have a set of prototype-enabled ajax code that is working in all browsers other than IE. In IE8 the JSON, that otherwise gets returned to the onSuccess handler function specified in Ajax.Request, gets thrown into a file download stream which pops up and prompts for where to download. askForm = $('askForm'); var askUrl = '.'; var askPar...

Real time output from paramiko with Django

How can I get data from paramiko channel class in real-time? I have 2 functions, the first one calls the second one from a HttpResponse (a generator basically): return HttpResponse(ssh_exec(request, job_id)) ssh_exec: def ssh_exec(request, job_id): job = ssh_job.objects.get(id=job_id) cmd_to_use = str(job.command) client = par...

how to set the default value for grouped choices in django

If I have some grouped choices for a models.IntegerField, how can I set the default value to a combination of those choices ex: class ForumThread(): STATE_CHOICES = ( ('Sticky', ( (True, 'True'), (False, 'False') ) ), ('Blocked', ( (False, 'False') (True, 'Tru...

Django Templates Variable Resolution

Hey there, it's been a week with Django back here so don't mind me if the question is stupid, though I searched over stackoverflow and google with no luck. I've got a simple model called Term (trying to implement tags and categories for my news module) and I have a template tag called taxonomy_list which should output all the terms assi...

Django question: An invoice that I want to send to an email

Hello, this is a Django related question. I have an invoice that I have created from a database which displays the information. Now I want to know is if I can send these details to an email address. I have tried looking at this page at http://docs.djangoproject.com/en/dev/topics/email/, but I don't know if I am looking for that. I am ass...

Are there any performance bottle necks in template inheritance?

Are there any performance bottle necks in template inheritance ...

Help with zc.buildout script to install Satchmo

Im trying to re-create a this satchmo environment using a buildout script: [buildout] parts = django satchmo eggs = pycrypto PIL pyyaml trml2pdf sorl-thumbnail django-registration django-caching-app-plugins django-threaded-multihost django-signals-ahoy django-keyedcache django-livesettings django satchmo Sphinx docutils extensions = ...

How to migrate a CSV file to Sqlite3 (or MySQL)? - Python

Hi folks, I'm using Python in order to save the data row by row... but this is extremely slow! The CSV contains 70million lines, and with my script I can just store 1thousand a second. This is what my script looks like reader = csv.reader(open('test_results.csv', 'r')) for row in reader: TestResult(type=row[0], name=row[1], res...

Comment framework in Google App Engine

Django’s has a comments framework with auto forms and its built in comment model http://docs.djangoproject.com/en/dev/ref/contrib/comments/ , is there any similar open source apps that can run this in Google App Engine with its datastore too? Thanks alot. ...

Expense of django query

I have two tables: Actor and Images. The Images table is linked to the Actor table through a Foreign Key. I might make a query on Actor that pulls a list of all the actors with first name beginning with the letter A. Let's say I store this query result in actor_list and pass it to the template. I can get a list of all the Images thro...