django

Python: How can I override one module in a package with a modified version that lives outside the package?

I would like to update one module in a python package with my own version of the module, with the following conditions: I want my updated module to live outside of the original package (either because I don't have access to the package source, or because I want to keep my local modifications in a separate repo, etc). I want import stat...

Django Barcode for store sales

I am in process of converting Visual Basic app into Python Django. Currently, it has barcode functionality to process sales at a store. Can this be achieved with python django. ...

Extending the User model with custom fields in Django

I am trying to extend the User model so that I can add my own custom fields but I keep getting an error stating: 'NoneType' object has no attribute '_default_manager' whenever I try to use user.get_profile() to add values to the custom field i.e. whenever I use it like so: user = User.objects.create_user(username, email...

inverse relation to multiple inheriting classes in django

Here are my schematic models: class Law(models.Model): ... class Bill(models.Model): ... # data for a proposed law, or change of an existing law class PrivateBill(Bill): ... # data for a Bill that was initiated by a parliament member class GovernmentBill(Bill): ... # data for a Bill that was initiated by the governme...

Testing Django Inline ModelForms: How to arrange POST data?

Hi folks, I have a Django 'add business' view which adds a new business with an inline 'business_contact' form. The form works fine, but I'm wondering how to write up the unit test - specifically, the 'postdata' to send to self.client.post(settings.BUSINESS_ADD_URL, postdata) I've inspected the fields in my browser and tried adding po...

django forms from two tables referencial integrity

i have a class named cv,and a class named university, and each user that completes his cv, should choose a University he studyes at. My problem is: one student can study at one or 2 or three universities, or may be a user that is not student. I need to take this data into a form, and i use ModelForm. The data from the Cv class, and fr...

Django - markup parser in template or view?

I am building a website where my pages are written in MediaWiki Markup, for which I have a working parser function in Python. Where exactly do I parse my markup: in the view's code, or in the template? My first guess would be something like: return render_to_response( 'blog/post.html', {'post': post, 'content...

How to make posted text expire in django?

Hi .. im wondering how to make some posted texts be deleted on some certain date/time on a django site. Is it done with scripts to delete content in the database? ...

Django Import Error with URLS and ROOT_URLCONF confusion

The error can be seen here: http://djaffry.selfip.com:8080/ In httpd conf, <VirtualHost *:8080> ServerName tweet_search_engine DocumentRoot /var/www/microblogsearchengine/twingle </VirtualHost> <Directory /var/www/microblogsearchengine/twingle> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv...

sqlite3.OperationalError

Hi, The "python manage.py syncdb" command is giving me the following error: sqlite3.OperationalError: unable to open database file I'm following the step by step instructions in Practical Django Projects, so I think this has to do something with the Windows Operating system acting quirky! Things I've checkde: 1.The path is updated ...

Django unit testing: South-migrated DB works in MySQL, throws duplicate PK error in PostGreSQL. Am I missing something or is this a bug?

Hi folks, (Worth starting off with a disclaimer: I'm very new to PostGreSQL) I have a django site which involves a standard app/tests.py testing file. If I migrate the DB to MySQL (through South),, the tests all pass. However in PostGresQL, I'm getting the following error: IntegrityError: duplicate key value violates unique constrain...

Do something every 3 loops in django-templates?

hi people, I wanna make change in css class every 3 loops. In the first three I want to use the CSS class A, in the next three I want to use the CSS class B, in the next three I want to use the CSS class A again and so on. can anyone help? Thanks ...

Why does TinyMCE in Django admin output HTML tags?

I have two apps using the same TinyMCE textarea configurations. However, while an input in an app does output the text properly, the same input in another app does not output the text properly -it outputs the <p> <li> tags, etc. I have exactly the same Django source code for these two different apps. As I mentioned above, two apps using...

Display/Edit fields across tables in a Django Form

I have 2 tables/models, which for all practical purposes are the same as the standard Author/Book example, but with the additional restriction that in my application each Author can only write 0 or 1 books. (eg, the ForeignKey field in the Book model is or can be a OneToOneField, and there may be authors who have no corresponding book in...

How to verify object creation in Django?

I want to verify that the object I created was really created, and return True or False according to that: obj = object(name='plop') try: obj.save() return True except ???: return False How can object creation be verified? ...

django forms overwrite data when saved

If a have a form, with the data from a user, let's say a CV, and i save the data from the form into a database, but i don't want that a CV from the same user to be stored in the database more than once(when edited form instance) I want it to be overwritten every time it is saved by one same user. How can i do it? thanks a lot ...

How do I tell Django to use MySql from a WAMP install?

I've had Django running with Sqlite for a while. I then installed WAMP, and I now want to get ready for a production run, and would like to switch to MySql. Is there a straightforward way of telling it about the MySql instance that is running with WAMP? ...

Why program with php frameworks if it can be done better with rubi on rails, python or java?

Hi, We have discussion in my job place about question (We use 1 of the php frameworks): Why program with php frameworks big web application if it can be done better with rubi on rails, python or java? Please say our opinion thanks ...

Django Commenting framework and voting

Hello, I want to implement a commenting system for some pages by using the build-in commenting framework of Django. The only addition to the default commenting framework is that other registered users can up/down vote comments (one time allowed indeed), just like Digg or Reddit style. I have found RedditStyleVoting however it seems out...

Django accepting GET parameters

Error can be seen here: http://djaffry.selfip.com:8080/ I want the index page to accept parameters, whether it be mysite.com/search/param_here or mysite.com/?search=param_here I have this in my URL patterns, but I can't get it to work. Any suggestions? urlpatterns = patterns('', (r'^$/(?P<tag>\w+)', 'twingle.search.views....