Hi,
I'm looking to the best way to overriding the _get_url method from ImageField, I need to customize the url since I don't want the default returned url (I distribute this image trhough a view to manage ACL on it so the url based on the MEDIA_ROOT is wrong).
Should I have to create my own ImageField ? or is there a solution using les...
hello, i want to include a css file into the header of my documents, but i have a few questions:
1.Where should i set the path to media, and it should be a relative/absolute path? In settings.py, i 've tried setting MEDIA_URL but my style is still 'unseen'
2.how can i make the htmls to inheric that syle (for not adding the href in every ...
if i have a question and answer system, and i want to add a tag feature, as for every question i should have some tags, separated by comma (just in stackoverflow):
1.I want to have a separate class model for that, with a foreign key to a question
2.in the form, i want the user to be able to add many tags, separated by comma, and when th...
if a have a question - answer system, where the answer form is included in the template of questions,(just like facebook post-comments) is there another way to save the comments for every question? how can i take the id of the question?
my code:
{%include "replies/replies.html"%} #thats in the template where questions are listed
the ...
in my app, i want to use a css file, but the tempalte doesn't 'know' where the file is, though i've configured it as in tutorials:
in the urls.py (the urls file in the root of the site, not belonging to an app)
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_DOC_ROOT}),
in the tem...
I am migrating a django project from 1.1.1 to 1.2.1
Now neither the {% url %} tag works nor the @models.permalink-decorated get_absulute_url works
i.e. I get
TemplateSyntaxError at /
Caught TypeError while rendering: __init__() got an unexpected keyword argument 'error_message'
for
<li><a href="{% url archive_talks %}">talks</a></...
Having the following django view code that generates a CSV response from a database view:
def _get_csv_stats(request, **filterargs):
result = GlobalStats.objects.select_related().filter(**filterargs).values_list('user__username',
'user__first_name','use...
In my Django webapp, I have a user submit data to Form1.html. The data is passed onto Form2.html where they submit more data. After they submit Form2 they are taken to Done.html.
Form1 >> Form2 >> Done
The problem is I need the data from Form1 in From2 and in the Done view. Getting the data from Form1 to the Form2 view is no problem, j...
I have Django model that looks like this:
class Categories(models.Model):
"""
Model for storing the categories
"""
name = models.CharField(max_length=8)
keywords = models.TextField()
spamwords = models.TextField()
translations = models.TextField()
def __unicode__(self):
return self.name
clas...
I'm using Django on GAE. When I say user = request.user, I believe it hits the datastore to fetch the User entity.
I would like to just get the key for the currently logged in user, because that will allow me to get the user-related data I need from the memcache.
...
I'm wanting to run PHP and Django together on the same apache config and I'm wondering how to do that?
devserver.com <- Serving PHP files from /var/www
devserver.com/django <- Serving Django from /var/www/django (/var/www/django/mod.wsgi)
Any idea how to do this?
...
hello,
I'm having a css file and i want to modify it to fit my needs.
The problem is that it seems to be cached somewhere, as i just cannot see the changes, no matter what i do in the css file.
I am sure i am pointing to the right file, as by now i'v modified in it, and it worked.
Is there any setting so that i can turn the cache off?
Th...
I want to store some mp3s in a folder wich is no public, cant be directly accessed trough the web and allow users to hear/download the songs with a browser only if they are logged in.
How can I do that ?
I do my web development with django, but If I know how it works is enough.
...
I'm using Django 1.2 and I want to have two user types (one for companies and one for consultants). I will either use an object in my model (something like a boolean for is_company or is_consultant) or Django's groups to distinguish them--depending on which is easier for this problem. I guess it wouldn't be much of a problem if I weren...
Let's say Form1 inherits after Form2. Form 1 has fields one, two, three. Can I define a method clean_one in Form2 (so clean for field inherited from other form) ?
...
I have a list of values I want to display in a template of django.
The list is more or less like this:
199801 string1
199802 string2
199904 string3
200003 string4
200011 string5
where the first column is a date in the form YYYYMM and the second is a generic string
the list is ordered by date desc
What I want to create is a list of ...
Hey all,
I've been working through an ordered ManyToManyField widget, and have the front-end aspect of it working nicely:
Unfortunately, I'm having a great deal of trouble getting the backend working. The obvious way to hook up the backend is to use a through table keyed off a model with ForeignKeys to both sides of the relationship ...
hi
i have something like this in my views.py
instance = get_object_or_404(register,pk=request.user.id)
Now if there is no related object against this user i receive i standard django 404 eror
saying no matches found.
what i want here is instead of receiving this 404 error redirect it to another page say "something.html". but i ...
I started learning python about a month ago and just finished going through most of diveintopython. I'm planning to build a very simple stackoverflow clone to further enhance my python skills; however, I'm not sure how to go about doing this. I don't really have a broad knowledge of web frameworks/technologies available and I'm wondering...
During user registration I'm calling some custom function :
def user_created(sender, user, request, **kwargs):
form = ExtendedRegistrationForm(validateemail=True, request.POST, request.FILES)
When requesting a form I need to give additional bool argument validateemail. This though give me error :
Exception Type: SyntaxError at /
...