Greetings,
I am currently working on a long term project that uses Django 1.1.1, and we are planning to release it around march of 2010.
Now while surfing I came upon to this article which says the planned release date of Django 1.2.0 is March 9, 2010.
Now I am a bit confused. If I should continue developing under 1.1.1 or start develo...
Hi, I want to allow the admins of my site to filter users from a specific country on the Admin Site. So the natural thing to do would be something like this:
#admin.py
class UserAdmin(django.contrib.auth.admin.UserAdmin):
list_filter=('userprofile__country__name',)
#models.py
class UserProfile(models.Model)
...
country=mode...
I'm doing some stuff on 'clean' on an admin ModelForm:
class MyAdminForm(forms.ModelForm):
def clean(self):
# Some stuff happens...
request.user.message_set.create(message="Some stuff happened")
class MyAdmin(admin.ModelAdmin):
form = MyAdminForm
Other than the threadlocals hack - how do I access request.user ...
Hay, i have a model which saves 2 images
class Picture(models.Model):
picture = models.ImageField(upload_to=make_filename)
thumbnail = models.ImageField(upload_to=make_thumb_filename)
car = models.ForeignKey('Car')
created_on = models.DateField(auto_now_add=True)
updated_on = models.DateField(auto_now=True)
def ...
Is there a more efficent way for doing this?
for item in item_list:
e, new = Entry.objects.get_or_create(
field1 = item.field1,
field2 = item.field2,
)
...
I want a search for my list box.The selected items should then be shifted into another box.The same functionality is provided by django admin where you add user permissions.Any idea how I can implement it in my app?
Thank u !!
...
I'm having an issue where a call to the url template tag in Django is appending the site name (I don't want it in there.)
Let's say that the site name is 'mysite'.
So for example:
<a href="{% url myapp.views.myview "myparam" %}">Link text</a>
is producing:
<a href="/mysite/foo/bar">Link text</a>
when I want it to produce:
<a hre...
I have a .py file that a php file runs like this:
$link = exec(dirname(__FILE__) . /xxx.py ' .excapeshellarg($url) . '2>&1', $output, $exit_code);
I want to run the xxx.py in my django view and asign the output to a variable. The xxx.py file has a def main(url) function and if __name__ == '__main__': at the bottom. Is there a way I c...
I ran into an interesting "oversight" in the Django {% cycle %} template tag. This has been listed as a bug, but I'm wondering if there is a workaround for it?
{% for r1 in range_0_2 %}
{% for r2 in range_0_3 %}
{{ r1 }}-{{ r2 }}-{{ cycle 'even' 'odd' }}
{% endfor %}
{% endfor %}
This yields:
0-0-even
0-1-odd
0-2-even
1-0-odd...
I run a small webapp for a couple of departments at work, which is very low traffic and doesn't have that many users. It's built on top of Django and uses apache as the web server.
I have things configured to email me when any errors occur which until yesterday was a great thing - there aren't many errors, but sometimes the users don't ...
Does anyone have a list of things they do to associate some model with a user?
I.e. if a blog entry has a user, you have to do a few things:
- Add a foriegnkey field
- Make the foreign key field editable = False
- On save/load make sure that request.user matches entry.user
This is what I could come up with. Is there an easier way to do...
Via django iam launching a thread (via middle ware the moment the first request comes) which continously fetches the twitter public steam and puts it down into the database.Assume the thread name is twitterthread.
I also have have several cron jobs which periodically interacts with other third party api services.
Observed the following...
So I'm late to the party here, but I just came across IGNORABLE_404_STARTS and IGNORABLE_404_ENDS. I'm trying to make use of this, but it isn't working for me. For instance, I set:
IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi','favicon.ico', '.php')
If I go to http://www.mysite.com/test/mail.cgi, I will ...
If I want to make sure that a view is listed as having public access, is there a decorator equivalent to @public_access which would be the opposite of @login_required and make it clear that the view should be publicly accessible always?
One use case I have in mind is to automatically add "@csrf_exempt" to all public views in addition to...
I'm using django 1.1 and flatpages. It works pretty well, but I didn't manage to get a catchall or default page running.
As soon as I add a entry to url.py for my startpage, the flatpages aren't displayed anymore.
(r'^', 'myproject.mysite.views.startpage'),
I now flatpages uses a 404 hook, but how do you configure the default website...
I'm trying to use django-tinymce to make fields that are editable through Django's admin with a TinyMCE field. I am using tinymce.models.HTMLField as the field for this.
The problem is it's not working. I get a normal textarea. I check the HTML source, and it seems like all the code needed for TinyMCE is there. I also confirmed that the...
I have django objects:
class Event(models.Model):
title = models.CharField(max_length=255)
event_start_date = models.DateField(null=True, blank='true')
...
class RegistrationDate(models.Model):
event = models.ForeignKey(tblEvents)
date_type = models.CharField(max_length=10, choices=registration_date_type)
start_dat...
Hi,
I created a form for adding notes about a customer in our web admin. I am using jQuery and Ajax to submit the for. I would like the Django view to return the newly added note/record so I can append it to the customer notes table. My Ajax send is working, and the note is being saved, I just can't display the result.
I have tried the...
I'm using a ChoicesField in my form, but I want to put a divider in it like this:
COUNTRIES = (
('CA', _('Canada')),
('US', _('United States')),
(None, _('---')), # <----------
('AF', _('Afghanistan')),
('AX', _('Aland Islands')),
('AL', _('Albania')),
('DZ', _('Algeria')),
('AS', _('American Samoa')),
...
I have a method on my user registration form that looks like this:
def save(self):
user = User(
username = self.cleaned_data['username'],
email = self.cleaned_data['email1'],
first_name = self.cleaned_data['first_name'],
last_name = self.cleaned_data['last_name'],
)
user.set_password(self.clea...