I have been playing with python and different web frameworks. I started with Django, but am not in so deep that I am entrenched. I really quite like python but have not found that "perfect" web solution.
My qualifications of perfect would be:
simple to learn/code
simple to host (my webhost, Site5, isn't exactly python-friendly)
wide...
I have a ModelForm with an additional filefield in it, now I can submit the form and the file is being uploaded the way I wanted also the records are being saved.
The problem is that when I'm editing, the filefield appears empty. How do I make it so it displays the current file uploaded on the record being edited?
...
I have something like this:
myobj = paginator_method(request, myresult)
return render_to_response(' ', myobj, context)
And when I am going to page 2 and onward its giving MultiValueDictKeyError:
Key 'name' not found in <QueryDict: {u'page': [u'2']}
...
I created a project with Django and am trying to write from forms to db.
The model class has two classes :
class Contact(models.Model):
name = models.CharField(max_length=200)
birth_day = models.DateTimeField()
address = models.CharField(max_length=200)
class PhoneNumber(models.Model):
PHONETYPE_CHOICES = (
(0, ...
If I "read out" from a db I just saved files to I get:
Your Name is: (u'Mike',)
Your Birthday is on: (datetime.datetime(2009, 12, 5, 0, 0),)
Instead of
Your Name is Mike
Your Birthday is on the 12/05/2009
How can I achieve this?
Thanks
@ Daniel:
The same is my example you answered just before:
this is how it is saved:
def m...
I have a django view function that calls another function if a condition is true, the function is called as a separate process, the view returns a status variable which shows if the function was called or not, the status is returned to a ajax click event assigned to a button.
The problem is that when the function 'do_work' is executed aj...
Hi,
I have a custom query which eventually returns a list of objects. I need the function to return the actual objects but I don't want to hit the database twice for every query since it's already an expensive query. How can i return a model instance without hitting the db?
NB: I presume doing something like the following will actually...
I have been using Django for web-development, and have become quite fond of that framework. However, I would like to use a similar framework but for more general network applications. Is there such a framework? Or is it possible to modify Django to be able to have a more general network/protocol backend?
...
My google search application making a request each time while i am using paginator. Suppose i have a 100 records. Each page have to show 10 records so ten pages. When i click 2nd page it again sending a request. Ideally it should not send the request.
...
Say I have a Sale model which is use to track sales made, with a sold_on field. I want to have two view in Admin, one showing all Sale and one showing Sale in last week.
I cant override ModelAdmin.queryset, as I want to see both the Querysets at different times. What is the best way to do this.
...
Greetings,
I would like to know if there is any already developed plugin for Django admin to have a better filter for the given date/datetime to filter between the given date interval instead of "today", "last week" etc..
Thanks
...
I need to run a django app on windows under either IIS6 or IIS7 (yes, I don't know the exact requirements right now).
What I did:
I've tried to set up a working environment on my windows 7 (so its IIS7 for now) machine. I've followed the instructions at django trac using PyISAPIe.
What came out of it:
Apparently, either I am doing some...
Hi , I am facing a problem in django development. Actually I am created a Model which include foreign keys of 4 other models . Now I user these all models at at admin site. Problem is that when I delete a record which is used a foriegn key in my main model then this deletion process also delete record from my main model . I required that...
I have 2 simple form/model classes
class Booking(forms.Form):
name = models.CharField(max_length=100, verbose_name="Your name*:")
place = models.ManyToManyField(Location, blank=True, null=True)
class Location(models.Model):
place = models.CharField(max_length=100)
When I display the form I only want to show locations...
I am wanting to add some extended permissions to django-facebookconnect namely "email". After looking through the code I see that the actual connect is managed in javascript. So, I thought that something like this might work
{% load facebook_tags %}
<script type="text/javascript">
FB_RequireFeatures(["XFBML"], function() {
F...
Is there any possibility to create custom action in admin page for django UserModel? I want automatize adding user to group (like adding him to staff, set some extra values, etc.), and of course create actions that take these changes back.
Thanks for your help.
...
Say that Blog model has a one-to-many relationship with Entry model. In a form, is there an elegant way display the set of Entries for a Blog instance as a list of checkboxes, so the user may select and process some/all of the Entries?
...
Hey,
I am trying to change order of nodes in my tree. Everything works fine, but I would like to know if there is some beautiful, easy way of updating multiple fields by increasing its actual value by 1. Let me illustrate.
Objtree.objects.select_related().filter(pk__in = ids).update(sort_order = 1)
This code will change every sort_or...
Suppose that a user creates an instance of MyModel in ProjectA that uses sqlite3 database site1.db. How would I in turn save this instance in site2.db owned by ProjectB?
...
Hello,
I'm trying to change my form to ajax form with jquery, but I get an invalid label error in javascript console.
My js code :
<script type="text/javascript">
$(document).ready(function() {
$('#jsonForm').ajaxForm({
clearForm: true ,
datatype: "json",
error:function(data){alert('Error:'+data);},
...