I am using a ForeignKey called Memberno in My Django models. After entering data in the Members Class, it appears in the other classes as "member object" in the 'memberno' field. For ForeignKey, I am using 'raw_id_fields' as a workaround, but for normal fields and even 'filter_horizontal' , each memberno value is displayed as "member obj...
I am building a web app that allows our field staff to create appointments. This involves creating a record that contains many foreign keys, of which some come from very large tables. For example, the staff will need to select one of potentially thousands of customers.
What's the best way of doing this in Django?
A pop-up box that a...
I have a booking model that needs to check if the item being booked out is available. I would like to have the logic behind figuring out if the item is available centralised so that no matter where I save the instance this code validates that it can be saved.
At the moment I have this code in a custom save function of my model class:
d...
Hay guys, in PHP when i want to load a differnet page (render, with all variables outputting) i would use
include 'mypage.php'
This would load the page up and render the output.
How do i do something like this in Django? My problem is that i have a "quick list" which lists a bunch of popular items. I want this list to appear on every...
My local django dev environment (apache 2.2, Python 2.6, Django 1.2a, mod_wsgi, sqlite, win7 64bit) is really slow. It usually takes 15sec-30sec to load a page.
Any ideas what might be slowing it down? Same application on the production server runs just fine.
Task manager shows:
...
ProgrammingError(1110, "Column 'about' specified twice"
/usr/local/lib/python2.5/site-packages/MySQLdb/connections.py
errorclass
<class '_mysql_exceptions.ProgrammingError'>
errorvalue
ProgrammingError(1110, "Column 'about' specified twice")
This error seems to be happening here in django_authopenid/views.py:
if 'bnewa...
Please have a look at the following:
It's on pastebin, because it doesn't wrap that well here.
http://pastebin.org/84945
I'm not even trying to serialize objects, so why is it giving me that error?
Regards Martin
...
Hey,
In the django admin panel I currently have a DateField showing a nice Javascript calendar for inputting dates. However, I am only interested in the Month and Year. So I was wondering if it was possible to have the calendar only show the months and year. (Extra brownie points if you can restrict its usage so that no dates in the fut...
Hey,
I am trying to have the pictures I upload in the Django admin panel to show up as thumbnails instead of the path. I have sorl installed and can make thumbnails that show up in my views.
I have found 2 snippets (http://www.djangosnippets.org/snippets/579/ and http://www.djangosnippets.org/snippets/934/) that I have tried to impleme...
I'm trying to follow the guidelines in this answer, but I'm getting stuck with how to edit the template.
The relevant part of my admin.py:
SegmentFormset = forms.models.inlineformset_factory(Division,Segment)
class DivisionForm(forms.ModelForm):
def __init__(self, **kwargs):
super(DivisionForm, self).__init__(**kwargs)
...
Hi, after going through some basic tutorials on the app engine and the webapp framework, I'm attempting to display documents that are related to a project construct I've created (e.g {% ifequal project.key doc.parentproject %} ) I have created several documents that do indeed have a doc.parentproject identical to keys from the project, b...
I'm using a standard example from the web (http://www.20seven.org/journal/2008/11/pdf-generation-with-pisa-in-django.html) to convert a django view / template into a PDF.
The mechanics work wonderfully. Thanks!
My question: Is there an "easy" way to include images (either from a url or a reference on the server) in the template so th...
I've added a custom field to a ModelForm for use in the admin:
class MyModel(models.Model):
name = models.CharField(max_length=64)
...etc...
class MyModelAdminForm(forms.ModelForm):
dynamicfield = forms.IntegerField()
def __init__(self, *args, **kwargs):
super(MyModelAdminForm, self).__init__(*args, **kwargs)
...
I've got a nice database I've created in Django, and I'd like to interface with through some python scripts outside of my website stuff, so I'm curious if it's possible to use the Django database API outside of a Django site, and if so does anyone have any info on how it can be done? Google hasn't yielded many hits for this.
...
I am hoping to use an imagefield in one of my Django models, and therefore created a very simple model, adjusted my settings file, uploaded the imagefield by adding the image from within the Admin application. Unhappily, the link attached to the image field in the Admin application does not provide the stored image, no matter what I try...
In my Django login I always rewrite a logged in users url to have their username in it. So if the username is "joe" I rewrite the url to be "joe.example.com". This works great except on IE8 for usernames with underscores like "joe_schmoe". IE8 won't login the users when the url is like: "joe_schmoe.example.com". In my settings file I...
I'm using django 1.0 and have a method in views.py that starts out like this:
def my_view(request, org_id):
a = request.user.is_staff() #this line has error
#more code...
When I try to load the page, I receive the error "'int' object is not callable" on the line marked above. My models.py file does contain a "User" object whi...
I have an Article model which has a date field. I want to query against all Article objects, and have a datatype returned with each distinct year, and then each distinct month within that.
for instance
archives = {
2009: {12, [, , ...], 11: [...]},
2008: {12, [...], 11: [...]},
}
is this possible?
...
Is it possible to use a generic view with additional parameters in the URL mapping - i.e. I got the following model:
class Route(models.Model):
area = models.ForeignKey(Area)
slug = models.SlugField(null=True,blank=True)
@models.permalink
def get_absolute_url(self):
return ('route_details', (), {'area': self.are...
Is there a way to extend the built-in Django Group object to add additional attributes similar to the way you can extend a user object? With a user object, you can do the following:
class UserProfile(models.Model):
user = models.OneToOneField(User)
and add the following to the settings.py file
AUTH_PROFILE_MODULE = 'app.UserProf...