django

How do I write this URL in Django?

(r'^/(?P<the_param>[a-zA-z0-9_-]+)/$','myproject.myapp.views.myview'), How can I change this so that "the_param" accepts a URL(encoded) as a parameter? So, I want to pass a URL to it. mydomain.com/http%3A//google.com Edit: Should I remove the regex, like this...and then it would work? (r'^/(?P[*]?)/?$','myproject.myapp.views.myvie...

PDF Form Field Manipulation

I'm making a web interface to autofill pdf forms with user data from a database. The admin needs to be able to upload a pdf (right now targeted at IRS pdf forms) and then associate the fields in the pdf with data fields in the database. I need a way to help the admin associate the field names (stuff like "topmostSubform[0].Page2[0].p2-...

How do I run a unit test against the production database?

How do I run a unit test against the production database instead of the test database? I have a bug that's seems to occur on my production server but not on my development computer. I don't care if the database gets trashed. ...

How to localize static content in database with Django

My app has tables for languages and countries (actually django-countries at the moment, but open for suggestions). The tables are populated when I initialize the database and remain static after that. What would be the ideal localization mechanism for the contents of these tables, so that I can show the country and language names to us...

how to get the field which name is 'www' in model Map..

class Map(Group): members = models.ManyToManyField(User, related_name='maps', verbose_name=_('members')) class Position(models.Model): map = models.ForeignKey(Map) LatLng = models.CharField(max_length=2000) and the Group is : class Group(models.Model): """ a group is a group of users with a common interest ""...

Django login, logout urls and current user name

Hi Guys, I'm new to Django and just just got django-registration up and running. Could anyone tell me how to get a get a log-in, log-out url name and the name of the current user in my template. Are these called template tags? IS there a comprehensive list somewhere for all the default variables supplied with Django. I'm a little lost ...

How do I write this Django model in SQL?

I want to create a new column. How do I write this in SQL? class mytable(models.Model): created_at = models.DateTimeField(auto_now_add=True) ...

Can we use the ORM in GAE with Django now?

Given that django-nonrel has got JOINs working, does this mean we have M2M fields workable with Django now in GAE? What other current restrictions does Django have in GAE? ...

mod_wsgi daemon mode vs threaded fastcgi

Can someone explain the difference between apache mod_wsgi in daemon mode and django fastcgi in threaded mode. They both use threads for concurrency I think. Supposing that I'm using nginx as front end to apache mod_wsgi. UPDATE: I'm comparing django built in fastcgi(./manage.py method=threaded maxchildren=15) and mod_wsgi in 'daemon' ...

Add a prefix do Django comment form

I would like to add a prefix to each django comment form. I'm using multiply comment forms in the same page and depsite it's working well, i don't like having many input fields with the same id attribute like <input type="text" name="honeypot" id="id_honeypot" />. So, is there a way to tell django do add a prefix to each form instance?...

Django User M2M relationship

When trying to syncdb with the following models: class Contact(models.Model): user_from = models.ForeignKey(User,related_name='from_user') user_to = models.ForeignKey(User, related_name='to_user') class Meta: unique_together = (('user_from', 'user_to'),) User.add_to_class('following', models.ManyToManyField('self',...

How to save to Django Model that Have Mulitple Foreign Keys Fields

I have this Model class inventory_transaction(models.Model): stockin = models.DecimalField(blank=True, null=True,max_digits=8, decimal_places=2) stockout = models.DecimalField(blank=True,null=True,max_digits=8, decimal_places=2) from_container = models.ForeignKey(container_identity) staffs = models.ForeignKey(staff_n...

Django foreign keys cascade deleting and "related_name" parameter (bug?)

In this topic I found a good way to prevent cascade deleting of relating objects, when it's not neccessary. class Factures(models.Model): idFacture = models.IntegerField(primary_key=True) idLettrage = models.ForeignKey('Lettrage', db_column='idLettrage', null=True, blank=True) class Paiements(models.Model): idPaiement = mod...

Django multiple many to many fields?

Hello everybody I am building a news app for my website. I want to use a sort of tag system. Each news article can have different and multiple tags. All tags are saved in a tag model, and i want to connect the tags to the newsarticle. Now is this possible with: tags = models.ForeignKey( TagsModel ) for one tag, but how i can do this wit...

django html/css windows mac problem width additional space on the top of the page

Hi, my problem is really strange... We are developing shopping-cart system in django. The problem is, when I change anything even single letter on my computer, strange space on the top of the page appears, see the picture... I don't know since when the problem appears. But if i go back to previous version (in this case 210, we use svn),...

Django and a referrer system implementation

Hello, I am trying develop a basic referrer system to my Django website, system will be generating a unique url for each users to share with their friends. Once these friends enter this website, system somehow keep the data that "this user is browsing by the reference of X user" and once this invited person decided to register for an acc...

Iterating over a database column in Django

I would like to iterate a calculation over a column of values in a MySQL database. I wondered if Django had any built-in functionality for doing this. Previously, I have just used the following to store each column as a list of tuples with the name table_column: import MySQLdb import sys try: conn = MySQLdb.connect (host = "localho...

Django newbie question: get count of associated ForeignKey, conditional on field within the ForeignKey table?

Hi all Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by = models.ForeignKey('VideoUser') problem_video = models.BooleanField(default=False) class VideoUser(models.Model): name = models.CharField(max_length=250 ) def num_videos(self): num_videos = Video.objects.fi...

Error when following along with the tutorial on the Django website

I am following the django tutorial here. I have copied everything exactly. After the part where you enter the python manage.py sql polls command, it returns: Error:App with the label polls could not be found. Are you sure yuor INSTALLED_APPS setting is correct? I have the site installed in /home/kevin/crossen/crossen, and the dir lis...

Default FileField names for Django files

I have a model: class Example(models.Model): unique_hash = models.CharField(max_length=32,unique=True) content = models.FileField(upload_to='source',blank=True,verbose_name="HTML Content File") I would like to be able to set the content filename to default to a callable, but I don't see any way to have the callable reference u...