I am storing dates as an integer field in the format YYYYMMDD, where month or day is optional.
I have the following function for formatting the number:
def flexibledateformat(value):
import datetime, re
try:
value = str(int(value))
except:
return None
match = re.match(r'(\d{4})(\d\d)(\d\d)$',str(value))
...
I'm new to both Django and Google App Engine, and am using a sandbox in OSX10.6 with the GoogleAppEngineLauncher. I've got a basic "bookstore" application running from the tutorial in the OReilly "Programming Google App Engine" book.
Here's the bug: If I add a new object to the datastore through the web interface, then it's readable thr...
Hi,
I am trying to produce a template with many addresses (forms), where you can add, edit and remove them.
Am I doing something wrong with formsets? Here are my views:
@login_required
def addresses(request):
AddressesFormset = modelformset_factory(Address,
can_delete = True,
...
OK, so let me give you an overview first. I have this site and in it there is a form section. When you access that section you can view or start a new project. Each project has 3-5 different forms.
My problem is that I don't want viewers to have to go through all 3-5 pages to see the relevant information they need. Instead I want to gi...
So I'm using Django to create a projects page with multiple forms for each project. Let's call them form 1, 2, 3, and 4. Once you create a project you can fill out any of these forms. I want to create "buttons" or links for each one of the forms that would show up on the main page. Now this is the part I need help with:
Step 1. I want i...
Lets say I have this class (simplified):
class Tag (...):
children = models.ManyToManyField(null=True, symmetrical=False)
Now I already implemented the functions get_parents, get_all_ancestors. Is there a nice pythonic way to just the top level tags? If I had designed my Tags differently (to point to the parents instead) I would j...
I have been following these instructions for setting up a Django production server with postgres, apache, nginx, and memcache. My problem is that I cannot get egenix-mx-base to install and without this I cannot get psycopg2 to work and therefore no database access :(.
I am attempting this on a VPS running a clean install of Ubuntu Hard...
Trying to save a model in Django admin and I keep getting the error:
Transaction managed block ended with pending COMMIT/ROLLBACK
I tried restarting both the Django (1.2) and PostgreSQL (8.4) processes but nothing changed. I added "autocommit": True to my database settings but that didn't change anything either. Everything that Google...
The docs for django.core.files.File imply I can do this: print File(open(path)).url but the File object has no attribute 'url' However, django.db.models.fields.files.FieldFile extends File and does have all the attributes described in the docs for File, but I can't create one without giving it a model field.
All I want it something that ...
i want to authenticate users using firstname and lastname
This is the code i am using
user = auth.authenticate(first_name=firstname,last_name=lastname,password=password)
it keep coming up with NoneType: None
i have checked the firstname and lastname plus password seen to be correct?
what i am doing wrong? thanks
...
Trying to query a 'Favorites' model to get a list of items a user has favorited, and then querying against a different model to get the objects back from that query to present to the template, but I'm getting an error: "invalid literal for int() with base 10"
Looking over all of the other instances of that error, I couldn't find any in ...
In my web app I would like to be able to email self-authenticating links to users. These links will contain a unique token (uuid). When they click the link the token being present in the query string will be enough to authenticate them and they won't have to enter their username and password.
What's the best way to do this?
...
This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell.
For instance, if the remote shell prompts for 'what is your name?' then I need to feed it 'first,last'.
Clarification: I know I said arbitrary input, but I was really tryi...
This seems very basic and I must be missing something, but here goes anyways...
With two models like so:
class School(models.Model):
name = models.CharField("Official School Name", max_length=128)
address = models.TextField("Address of the School", max_length=256)
mascot = models.CharField("Name of the School Mascot", m...
Continue from this question. I'm getting this error when running the application
Caught an exception while rendering: Tried xd_receiver in module myfirstapp.fbapp.views. Error was: 'module' object has no attribute 'xd_receiver'
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/j...
HI
I have a django application running on app engine and I want to add a twitter login to my application.
Do you have a good links how to do that. I already registered my app in twitter.
Just don't know how to do login/logout buttons.
Thanks, Arshavski Alexander
...
I have a Django form that uses an integer field to lookup a model object by its primary key. The form has a save() method that uses the model object referred to by the integer field. The model's manager's get() method is called twice, once in the clean method and once in the save() method:
class MyForm(forms.Form):
id_a = fields.I...
my ajax is :
$('#save').click(function(){
$.post("http://127.0.0.1:8080/sss",
function(data){
alert(data);
});
})
and the django view is :
def sss(request):
return HttpResponse('ddddddddddd')
how to get some data from the view 'sss'
thanks
...
Hi all,
I was some time ago busy with ExtJS and ajax. I've have some data in csv format that i return. With ExtJS you can use the option isUpload to popup a file "filename.csv" where you can click save / open etc. Now i'm moving all ExtJS to Jquery and i don't seem to find something which handles this in Jquery, there is no option isUpl...
Trying to retrieve blogs (see model description below) that contain entries satisfying some criteria:
Blog.objects.filter(entries__title__contains='entry')
The results is:
[<Blog: blog1>, <Blog: blog1>]
The same blog object is retrieved twice because of JOIN performed to filter objects on related model. What is the right syntax for...