django

Accessing html table rows in python django

Hi I am very new to both django and python... I have a html table with person information in each row...How do i get a particular row entry/id of the one i need to edit/delete to accordingly update/delete the row in database?? ...

Django - problem with {% url facebook_xd_receiver %}

I'm using {% url facebook_xd_receiver %} in one of my HTML files. This works just fine when I run my project using the command python manage.py runserver But the same project stops running and gives me a "TemplateSyntaxError" at the line {% url facebook_xd_receiver %} Can anyone please tell me what could be the difference betwe...

working on django development server but not on apache

i am facing an issue with the apache server, we have written the code, in which if the url entered in the form field is valid it will display an error message, when i run the code through django developement server it works fine, displays the error message, but when running through apache, then does not show the error message just return...

reading input file from server and displaying output on client side

Hi, I have to read a file from server side . Obtained its contents stored it in a list and sent it to template Now, My question is how to access this list so as to display the contents of files line by line . I am using ajax and jquery to obtain the data on client side def showfiledata(request): f = open("/home/tazim/webexam...

Creating form object for variable kind of form.

i want to create a form for users to submit questions in django ..so far the models i have created are class Question(models.Model): statement=models.CharField(max_length=100) class Choice(models.Model): statement=models.CharField(max_length=100) value=models.IntegerField() question=models.ForeignKey(Question) Now i...

django admin how to limit selectbox values

model: class Store(models.Model): name = models.CharField(max_length = 20) class Admin: pass def __unicode__(self): return self.name class Stock(Store): products = models.ManyToManyField(Product) class Admin: pass def __unicode__(self): return self.name class Product(models.Model): name = models.CharField...

How to list all the objects with a specific date no matter the time in a DateTime Field

I Have a model like this foo=models.char bar=models.dateime In wich several foos arrives in one day in different time. I need to list all the foos in a specific date, no matter the time they arrive. I can't change the model, so splitting the bar in two fields(one for date and one for time) is out of reach right now :( ...

How to expire session due to inactivity in Django?

Our Django application has the following session management requirements. Sessions expire when the user closes the browser. Sessions expire after a period of inactivity. Detect when a session expires due to inactivity and display appropriate message to the user. Warn users of a impending session expiry a few minutes before the end of t...

Django: How do I redirect a post and pass on the post data

When processing a POST request in the Django views.py file, I sometimes need to redirect it to another url. This url I'm redirecting to is handled by another function in the same Django views.py file. Is there a way of doing this and maintaining the original POST data? UPDATE: More explanation of why I want to do this. I have two web a...

can't import own django module using fcgi

I'm running a django app through fcgi on my school's shared hosting system. Everything works initially (standard start page shows when I view the directory with index.fcgi) but when I add a module and try to import, I get the following error. The same code works when I run on my local machine. [Fri Jun 11 04:45:30 2010] [warn] mod_fcg...

Python module being reloaded for each request with django and mod_wsgi

I have a variable in init of a module which get loaded from the database and takes about 15 seconds. For django development server everything is working fine but looks like with apache2 and mod_wsgi the module is loaded with every request (taking 15 seconds). Any idea about this behavior? Update: I have enabled daemon mode in mod ws...

Django m2m form appearing fields

I have a classroom application,and a follow relation. Users can follow each other and can create classrooms.When a user creates a classroom, he can invite only the people that are following him. The Classroom model is a m2m to User table. i have in models. py: class Classroom(models.Model): creator = models.ForeignKey(User) c...

Should my web based app be a consumer of my api?

I will be developing a mobile app (iPhone) and a web based app (Django) soon. For the mobile app I will be creating a REST api (most likely using Django) to send data back and forth from phone to server. When I comes time to create the web based version does it make sense to just create it as any other client of the api. In other words ...

How to select random image of specific size using Django / Python?

I've been using this little snippet to select random images. However I would like to change it to select only images of a certain size. I'm running into trouble checking against image size. If I use get_image_dimensions() I need to use a conditional statement, which then requires that I allow exceptions. So, I guess I need some pointe...

List all form related errors in django

Hi, Is there a direct way of listing out 'all' form errors in Django templates. I'd like to list out both field and non-field errors and any other form errors. I've found out how to do this on a per-field basis but as said earlier, I'd like to list out everything. The method I'm using doesn't seem to list out everything. {% for error...

Getting a KeyError in DB backend of django-digest

I have just started to integrate django_digest into my app. As a start I have added the @httpdigest decorator to one of my views. If I try to connect to it I get a KeyError exception thrown in django_digest/backend/db.py . Depending on which db I configure I get a different KeyError in a different location. I am using Django 1.2.1, wi...

how to code a batch file to automate django web server start

Hi, i really need a code sample to automate starting Django development webserver "python manage.py runserver" in a .bat file in windows . I have python26 and django 1.1.1 in installed Thanks i meant by automate is clicking on the .bat file and the Django development webserver start up and i have no batch file scripting knowledge wi...

'RegistrationTestModel has no attribute '_deferred'

I am trying to get the Django Shell working with the Google App Engine. Unfortunately, I am getting the following error: AttributeError: type object 'RegistrationTestModel' has no attribute '_deferred' Does anyone have any idea of how to fix this? Stack trace: WARNING:root:Could not read datastore data from /var/folders/X0/X0QgAfs7H...

Django not recognizing django admin urls

I just registered my models my models with django admin. I navigate to the django admin at /admin. I log in sucessfully and I can see all my models. great so far. But now if I try to click one of the links, for Ex: 'users', django gives me a 404 saying The current URL, admin/auth/user/, didn't match any of these. Its really weird b...

What is the best way to implement a 'last seen' function in a django web app?

I have a running django/apache2 + memcached app (ubuntu) and would like to keep track of logged in users that are online. What would be the best way to track this? I would prefer not writing to the database each time a logged in user loads a page; but what other options are there? ...