In Django I get this error "Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format." when I try to assign a string "22-DEC-2009" to a DateTimeField in a model.
How is it possible to make DateTimeField accept a date string in format "22-DEC-2009"?
...
Hello everyone,
I have been working for hours trying to understand the following problem: I have a user send an Ajax request to dynamically send a form and record that the number of forms to read on submission has increased. Toward this end I use request.session['editing_foo'] = { 'prefix_of_form_elements' : pkey } so that I can associa...
The following code in one of my views returns unescaped html string which cannot be parsed in frontend since it is an Ajax request.
return render_to_response(template_name, {
'form': form,
redirect_field_name: redirect_to,
'site': current_site,
'site_name': current_site.name,
}, context_instance=Reque...
I need the html returned using render_to_response to be escaped.
I am unable to find any suitable documentation. Can someone point in some direction ?
the code is :
return render_to_response(template_name, {return render_to_response(template_name, {
'form': form,
redirect_field_name: redirect_to,
'si...
Hello guys,
Basically, I just want to be able to get the parameter community_name, can this be done with
(r'^(?P<community_name>\w+)/matches/submit/$', MatchWizard([MatchStep1Form, MatchStep2Form, MatchStep3Form])),
or do I need a view?
If I have a view, I can have the URLConf like
(r'^(?P<community_name>\w+)/matches/submit/$', "mat...
I have a simple view function that's designed to allow the user to choose from items listed in an html table (records). Clicking on a record should divert the user to the template from which he can edit that specific record. The code is as follows:
def edit_record(request):
if request.method == 'POST':
a=ProjectR...
A few days back I was messing around with Django, trying to get a feel for how stuff works, when I decided to try and build a simple forum, one that resembled a forum that I frequented (but is now closed down). The idea was that each of the comments would be parent to any number of comments, like so:
comment <--top
comment <-- comme...
Hi, what im experimenting is the next:
S:\proj>manage.py shell
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) django 1.1.1
>>> from django.contrib.auth.models import User
>>> u = User(username='luis', password='admin')
>>> u.save() #sucessfull created in mysql db
>>> from django.contrib.auth import authenticate
>>> usuario = authenti...
Hi, how should I write "mąka" in Python without an expection?
I've tried var= u"mąka", var= unicode("mąka") etc... nothing helps :/
...
I'm new to Macs (and quite new to Django) and I'm setting up an existing Django/MySQL site that uses Mercurial as a site package, on a new Macbook Pro.
All was going well during installation - no error messages. I installed the default versions of most packages from macports.
However when I try runserver, localhost shows the followin...
I am trying to populate a Django formset using data from a POST request. I am able to display the formset properly and instantiate it again mostly alright, but I'm having an issue where the formset is ending up with 2 blank rows at the end, which is undesirable. Below is the function we've been using in views.py:
forms.py
class Depos...
Hi, I have a flash file which is on a separate media server and the relative path is
/flash/as3.swf
I want to pass this to the template so when it gets rendered it gives the absolute path i.e.
http://myweb.site.com/flash/as3.swf
but when I render it the url is always /flash/as3.swf
Any ideas?
...
I'm planning a web application using Django, and it's based on a big pile of data from RSS feeds. What would be the best database to use to store the content of a lot of posts and metadata, as well as data about how each user relates to each post?
I've heard that the consensus is that ZODB is too slow, but it'd be handy to have a databa...
Hi,
I have this admin.py
class LawyerAdmin(admin.ModelAdmin):
fieldsets = [
('Name', {'fields': ['last', 'first', 'firm_name', 'firm_url', 'school', 'year_graduated']}),
]
list_display = ('last', 'first', 'school', 'year_graduated', 'firm_name', 'firm_url')
list_filter = ['school', 'year_graduated']
search...
I have these models:
(pseudocode)
Course:
ForeignKey(Outline, null=True, blank=True)
ForeignKey(OutlineFile, null=True, blank=True)
Outline:
//data
OutlineFile:
//different data
The situation is that any course can have an Outline associated with it, and/or an OutlineFile, or neither. An Outline can be asso...
I periodically get this problem where all of a sudden mako is using old versions of templates, and it's not until I manually go and update the template files that they'll use the current version. I'm using
./manage.py runserver
I think it's usually after I update using source control, but it's intermittent, and I can't reliably reprod...
I kept thinking a lot about the meaning of migrating a Django app the last few days and heard about migrating Django apps with django-south. Maybe it's just the lack of sufficient English skills (as English is not my native language) or this is one of the things you confront in a programmer's life which are so simple, that it takes a gen...
Say I have the following models:
class Image(models.Model):
image = models.ImageField(max_length=200, upload_to=file_home)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
class Article(models.Model):
text = models.TextField()
...
Hello,
I've been running into a problem while trying to delete uploaded images.
The error is along these lines:
SuspiciousOperation: Attempted access to '/media/artists/12-stones/154339.jpg' denied.
After reading around it looks like the error is due to the fact that it's looking for the image in the wrong place (notice first slash...
I read from
http://www.packtpub.com/article/friends-via-email-social-web-application-django-1.0
and follow the steps:
=> And change my
setting.py
SITE_HOST = '127.0.0.1:8000'
DEFAULT_FROM_EMAIL = 'KSO Publisher <[email protected]>'
EMAIL_HOST = 'smtp.xxxx.com.kh'
EMAIL_PORT = '25'
EMAIL_HOST_USER = '[email protected]'
EMAIL_...