Hey, I'm fairly new to Django, and I'm looking to edit admin class variables dynamically (The full idea is to hide inlines on adding and only show on editing, but I'm distilling the issue here).
Could someone explain why this doesn't work?
class dbTablePermissionInline(admin.TabularInline):
model = dbPermission
class adminDbTable(...
Hi
Apart from one example in the docs, I can't find any documentation on how exactly django chooses the name with which one can access the child object from the parent object. In their example, they do the following:
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_len...
Hello!
I'm looking to migrate users of a rails app which uses the Restful Authentication module (which uses a stretched sha1 encryption algorithm) to a Django app, using the default authentication framework (which uses a plain sha1 algorithm). Does anybody know how I can make this happen? specifically, can I somehow implement the same e...
Hello, I am a newbie in Django. I am writing a sample application that has a form, submit that form then saving the data into the database. My form need to be validated before allowing to save data. So my question is how can I pass the error messages (that generated by validation) to the view? Any suggestion are welcome. Thanks!
...
I use request.user.get_profile() in a number of places in my code. However not all uses have a user profile assosiated with their account. Is there some way I can create a user profile automatically when calling request.user.get_profile() if they don't have one without having to change each one of my request.user.get_profile() calls. ...
request.session['list'] = []
if request.method =='POST':
newrecord = request.POST['market']
tmp = request.session['list']
tmp.append(newrecord)
request.session['market_list'] = tmp
I turn out that previous data was overwrite by the new one
...
I've a table of partner type
PartnerType
Name
Description
RelatedToProject
I've a PartnerMaster
Name
Address
PartnerType
I've a Project Table
Name
Partner (from partner master)
The partner in the project table has to be only of those types who have RelatedToProject = True
How can I achieve this in the model definition itself.
...
Hello.
I'm getting an error when I'm trying to dump data to a JSON fixture in Djanog 1.2.1 on my live server. On the live server it's running MySQL Server version 5.0.77 and I imported a lot of data to my tables using the phpMyAdmin interface. The website works fine and Django admin responds as normal. But when I try and actually dump t...
I am exploring Django with MySQL & have a few things that I wanted to discuss -
How can I add an index (on some field)? Can I do it through the Django Model Layer?
If I want to migrate some old data into these new DB tables/models, will I have to write some script myself or does Django provide schema to schema mapping tools?
If I need...
Hey all
I wanted to know is Django a good choice for a big web applicatin(Social Network)? More specifically, I need some suggestion on performace when number of DB transactions increases and I want to know is the embedded OR Mapping included inside Django is a good choice or should I implement them.
Thanks
...
so I have 2 classes
this one:
class updateForm(forms.Form):
address = forms.CharField(
max_length = 255,
label = 'Home Address',
)
cnp = forms.CharField(
max_length = 15,
label = 'CNP',
...
Almost always when I try to use a re-usable django app, I end up doing a lot of integration work and/or the end result is really messy.
A common, simpler case is sending confirmation messages (with link text framework) to the user, for events that take place in the re-usable app. Take for example django-profiles - in order to show a "pr...
If I do a nc 192.168.2.10 8080 and then GET /test/ I get as expected a JSON response:
Content-Type: text/javascript
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 74
{ ... a JSON message ...}
However, if I do a POST /test/ I get the following HTML doc as a result:
<head>
<title>Error response</title>
...
Hello,
I have the following multi-table inheritance situation:
from django.db import Models
class Partner(models.Model):
# this model contains common data for companies and persons
code = models.CharField()
name = models.CharField()
class Person(Partner):
# some person-specific data
ssn = models.CharField()
cla...
Assuming I have a 'get_item' view, how do I write the URL pattern for the following php style of URL?
'http://example.com/get_item/?id=2&type=foo&color=bar
(I am not using the standard 'nice' type of URL ie: 'http://example.com/get_item/2/foo/bar as it is not practical)
Specifically, how do I make I make the view respond when ...
For whatever reason, when I was new to Python and Django, I wrote some import statements like this at the top of a models.py file:
from django.contrib import auth
And I'd use it like this:
class MyModel(models.Model):
user = models.ForeignKey(auth.models.User)
# ...
This worked fine. A long time later, I wrote a custom mana...
I'm trying to upload a file using "AJAX", process data in the file and then return some of that data to the UI so I can dynamically update the screen.
I'm using the JQuery Ajax Form Plugin, jquery.form.js found at http://jquery.malsup.com/form/ for the javascript and using Django on the back end. The form is being submitted and the proc...
This is a problem concerning django.
I have a model say "Automobiles". This will have some basic fields like "Color","Vehicle Owner Name", "Vehicle Cost".
I want to provide a form where the user can add extra fields depending on the automobile that he is adding. For example, if the user is adding a "Car", he will extra fields in the fo...
I've got a simple function to get some additional data based on request.user:
def getIsland(request):
try:
island = Island.objects.get(user=request.user) # Retrieve
except Island.DoesNotExist:
island = Island(user=request.user) # Doesn't exist, create default one
island.save()
island.update() # Run scheduled tasks
return islan...
I want to display a message to admins after they save a particular model, something like "Now enable the series".
I can see how I'd do this if it were a list action (message_user) but I can't see how to do this from the main CRUD form.
Does anyone know how?
Thanks
...