change database schema ``Public``
HI friends, How can we change the database schema ``Public`` to ``MySchema``. Default syncdb will create tables in public schema. How can i change it? Thanks & Regards, Jayapal D -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django and handling form validation errors
On Jul 14, 12:22 am, reduxdj wrote: > HI, > > (sorry for this re-post, my original post isn't here??, so I replaced > it, and I have been checking up all day as I hope to find the > solution) > > Forgive me, here's another n00b doozie. I've created a form, which > extends form, however, my form is not validating and I can't get the > form to print errors next to my form fields. What's curious, at the > form.is_valid() > in all the examples, I don't see an else: clause. Which leads me to > believe that a validation error should be > raised at this point, so an else is not neccessary?? > > So, my form should hold clean_fieldname methods for each field name > correct? and if an error is raised, > automagically, django handles the error messages, as long as it's > defined in my template, correct or not? > So every property needs a clean method? > > Sorry, I've read the resources and I'm a little unclear on this? > > Thanks for your time, > Django and the community rocks > > from my views: > > def listing(request): > if request.method == 'POST': # If the form has been submitted... > new_listing = Listing() > form = ListingForm(data=request.POST,instance=new_listing) > #form.save() > if form.is_valid(): # All validation rules pass > form.save() > return HttpResponseRedirect('/listing/') # Redirect after > #else: > #return HttpResponseRedirect('/listing/') # Redirect after > #return HttpResponse('form is a failure, like you.') > #return HttpResponseRedirect('/create/') # Redirect after > else: > form = ListingForm() # An unbound form > return render_to_response('listing.html', { > 'form': form, > }) > What's happened is that you have indented the final line too much. It should line up with the main function content - ie on the same level as the 'else' above it, it shouldn't actually come under that else. That means that if the form is a post, but doesn't validate, the flow falls from if form.is_valid() straight down to that return - and so the form that was instantiated by passing in request.POST is passed back to the template, and rendered along with its errors. This is why you don't need that commented-out else block. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Filtering a List
On Jul 14, 12:17 am, Micah wrote: > Example:http://dpaste.com/217886/ > > Line 6 is what I have a question about. Should I use javascript to > deal with that? If so, can the javascript access the django boolean? > Is there a way for Django to make runtime changes like this (filter / > unfilter checkbox or button)? How would I go about this task by > refreshing the page when the user presses the checkbox or button, post > data I am assuming but how would I have Django access that? > > In case it isn't obvious, I am relatively new to Django so a point in > the right direction may suffice. I have Googled a bit for a solution > but couldn't find anything, though it's possible I am just using the > wrong terms. No, you can't use javascript there. The template is evaluated when first rendered, so the if statement no longer exists by the time the javascript executes. The way to do this is to output the content regardless, but use javascript to hide it (set the 'display' style to 'none'), then more javascript to unhide it when the box is ticked. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
return number instead of string in admin
Hi, in the tutorial i see that to return a string or a combination of strings, i can do: def __unicode__(self): return u'%s %s' % (self.firstname, self.surname) what do i need to do to return a number? or more importantly, what is the def called to ensure it is read and returned when looking at the class in admin? Thanks, Alan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: return number instead of string in admin
Hi, Why not def __unicode__(self): return u"%d" % self.mynumber ? Nuno On Wed, Jul 14, 2010 at 11:15 AM, alan-l wrote: > Hi, > > in the tutorial i see that to return a string or a combination of > strings, i can do: > def __unicode__(self): > return u'%s %s' % (self.firstname, self.surname) > > > what do i need to do to return a number? or more importantly, what is > the def called to ensure it is read and returned when looking at the > class in admin? > > > Thanks, > > Alan > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
On Jul 12, 3:59 pm, Andi wrote: > On Jul 12, 3:40 pm, Nick Raptis wrote: > > > Yea, for some reason, my thoughts went to Weave too. Maybe it has > > something to do with it, maybe it doesn't. Haven't got any more trouble > > since I fixed it though. > > Glad I could help :) > > I'm using Weave too, don't think that's a coincidence. Another Weave user here, and I confirm both the problem and the solution. Thanks a lot for solving this, it was driving me crazy! George -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: return number instead of string in admin
Try this instead: def __unicode__(self): return u"%d" % (self.mynumber, ) On Wed, Jul 14, 2010 at 3:57 PM, Nuno Maltez wrote: > Hi, > > Why not > > def __unicode__(self): >return u"%d" % self.mynumber > > ? > > Nuno > > On Wed, Jul 14, 2010 at 11:15 AM, alan-l > wrote: > > Hi, > > > > in the tutorial i see that to return a string or a combination of > > strings, i can do: > >def __unicode__(self): > >return u'%s %s' % (self.firstname, self.surname) > > > > > > what do i need to do to return a number? or more importantly, what is > > the def called to ensure it is read and returned when looking at the > > class in admin? > > > > > > Thanks, > > > > Alan > > > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Unknown command: graph_models
Hello, Sorry if this thread already exists. I've searched but nothing could find. I tried this code: python manage.py graph_models graphdb -o scheme.dot But I got this error: Unknown command: 'graph_models' Type 'manage.py help' for usage. I installed python-graphviz, graphviz-deb, python-django-extensions but still I have the error. Anything's missing? Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
On Wed, Jul 14, 2010 at 6:47 PM, George Sakkis wrote: > On Jul 12, 3:59 pm, Andi wrote: > >> On Jul 12, 3:40 pm, Nick Raptis wrote: >> >> > Yea, for some reason, my thoughts went to Weave too. Maybe it has >> > something to do with it, maybe it doesn't. Haven't got any more trouble >> > since I fixed it though. >> > Glad I could help :) >> >> I'm using Weave too, don't think that's a coincidence. > > Another Weave user here, and I confirm both the problem and the > solution. > > Thanks a lot for solving this, it was driving me crazy! I'm glad we've worked out that Weave is the culprit, but nobody has answered the question of whether this is an indicator of a problem with Django itself. What is weave passing as a header (and under what conditions) that is causing a problem? Is there a need to improve Django's error handling to protect against this case? Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
reset user password
Hi Guys, I'm building a django application and i want to set up a class that wiil the user te reset his password each 2 weeks. Thanks -- Nadae Ivar Badio +221773018068 +221706404845 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Form validation and template errors - need n00b help
On Tue, Jul 13, 2010 at 4:06 PM, reduxdj wrote: > HI, > > Forgive me, here's another n00b doozie. I've created a form, which > extends form, however, my form is not validating and I can't get the > form to print errors next to my form fields. What's curious, at the > form.is_valid() > in all the examples, I don't see an else: clause. Which leads me to > believe that a validation error should be > raised at this point, so an else is not neccessary?? > > So, my form should hold clean_fieldname methods for each field name > correct? and if an error is raised, > automagically, django handles the error messages, as long as it's > defined in my template, correct or not? > So every property needs a clean method? > > Sorry, I've read the resources and I'm a little unclear on this? > > Thanks for your time, > Django and the community rocks > > from my views: > > def listing(request): > if request.method == 'POST': # If the form has been submitted... > new_listing = Listing() > form = ListingForm(data=request.POST,instance=new_listing) > #form.save() > if form.is_valid(): # All validation rules pass > form.save() > return HttpResponseRedirect('/listing/') # Redirect after > POST > #else: > #return HttpResponseRedirect('/listing/') # Redirect after > POST > #return HttpResponse('form is a failure, like you.') > #return HttpResponseRedirect('/create/') # Redirect after > POST > else: > form = ListingForm() # An unbound form > return render_to_response('listing.html', { > 'form': form, > }) > Unindent the 'return render_to_response(...' lines, so that they are executed when you have an invalid form. The form will be re-rendered, except this time the form instance will be bound, and have appropriate error messages in it. eg: if request.method == 'POST': form = ... if form.is_valid(): ... else: form = ... return render_to_response(...) Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Multiple languages question about /jsi18n/
Any ideas? This is driving me nuts. I've just hit a problem where I have strings defined for two apps: project/app1/locale project/app2/locale I added a new project app3 (project/app3/locale) and defined strings, compiled them but they're not available in the catalog. I'm starting to think there are major problems with language support in Django 1.1.2. I'm stuck on 1.1.2 as my app runs on a server I cannot control or upgrade. Thanks On Jun 7, 12:19 pm, Stodge wrote: > Ok I think I see what's happening. I have js strings defined in > project/locale and project/app/locale. jsi18n isn't picking up the > project level strings but it is seeing the app strings. This doesn't > sound right to me. > > On Jun 7, 9:06 am,Stodge wrote: > > > > > I have the jsi18n view defined in my URLs. I've added a call to > > gettext() in javascript and added the string definition in > > djangojs.po. I then compiled the messages and re-started the server. > > But the resulting string retrieved from gettext() is the tag, e.g. > > 'my_title'. > > > Did I forget something? I'm sure I have everything setup, but my > > catalog is always empty. > > > On Jun 4, 10:49 am,Stodge wrote: > > > > I think I have basic internationalisation working for english and > > > french. I can switch languages and change the page's title > > > accordingly. However, if I visit: > > > > /jsi18n/ > > > > I see the catalog definition and a few gettext related functions etc. > > > However, these are defaults and the translations in the catalog are > > > not mine and are always french, regardless of the language. > > > > What are these translations in the catalog and why are they always > > > french? Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: return number instead of string in admin
brilliant, thank you. is there a python or django page that layouts all the available options that can be after the percentage and what they mean? Thanks, Alan On Jul 14, 11:35 am, Subhranath Chunder wrote: > Try this instead: > > def __unicode__(self): > return u"%d" % (self.mynumber, ) > > On Wed, Jul 14, 2010 at 3:57 PM, Nuno Maltez wrote: > > Hi, > > > Why not > > > def __unicode__(self): > > return u"%d" % self.mynumber > > > ? > > > Nuno > > > On Wed, Jul 14, 2010 at 11:15 AM, alan-l > > wrote: > > > Hi, > > > > in the tutorial i see that to return a string or a combination of > > > strings, i can do: > > > def __unicode__(self): > > > return u'%s %s' % (self.firstname, self.surname) > > > > what do i need to do to return a number? or more importantly, what is > > > the def called to ensure it is read and returned when looking at the > > > class in admin? > > > > Thanks, > > > > Alan > > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > > To post to this group, send email to django-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > > . > > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin Model Validation on ManyToMany Field
Hi, Just a guess: have you actually selected a user and a folder when submitting the form? I think only valid field are present on the cleaned_data dict, and your users and folder fields are not optional (blank=True, null=True). hth, nuno On Tue, Jul 13, 2010 at 1:45 PM, Heleen wrote: > Hello, > > I have the following classes: > class Application(models.Model): > users = models.ManyToManyField(User, through='Permission') > folder = models.ForeignKey(Folder) > > class Folder(models.Model): > company = models.ManyToManyField(Compnay) > > class UserProfile(models.Model): > user = models.OneToOneField(User, related_name='profile') > company = models.ManyToManyField(Company) > > Now when I save application, I would like to check if the users do not > belong to the application's folder's companies. > I have posed this question before and someone came up with the > following sollution: > forms.py: > class ApplicationForm(ModelForm): > class Meta: > model = Application > > def clean(self): > cleaned_data = self.cleaned_data > users = cleaned_data['users'] > folder = cleaned_data['folder'] > if > users.filter(profile__company__in=folder.company.all()).count() > 0: > raise forms.ValidationError('One of the users of this > Application works in one of the Folder companies!') > return cleaned_data > > admin.py > class ApplicationAdmin(ModelAdmin): > form = ApplicationForm > > This seems like right the way to go about this. The problem is that > neither the users nor folder fields are in the cleaned_data and I get > a keyerror when it hits the users = cleaned_data['users'] line. > > I was hoping that someone here could explain to me why these > manytomany fields don't show up in cleaned_data and that someone could > possibly give me a sollution to my problem. > > Thanks! > Heleen > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Javascript string catalogs (jsi18n) - accessing strings in project/locale?
Wow - I think you just fixed my problem! Awesome. Thanks! On Jul 12, 4:57 pm, Jari Pennanen wrote: > Hi, I know this comes late, but for the future reference: > > My problem was that I had "locale" directory in *project* directory, > "myproject/locale" but I didn't have myproject in INSTALLED_APPS. > > So the thing that contains localization strings *must* be ALSO in the > INSTALLED_APPS = [..., 'myproject'] > > On 8 kesä, 16:13, Stodge wrote: > > > > > I ran makemessages -d djangojs from my project level directory, and > > Django automatically generated the .po file in project/locale/. I > > followed the documentation (and the book The Definitive Guide to > > Django) but I cannot access these translated strings. The catalog is > > always empty. My urls contains: > > > js_info_dict = { > > 'packages': ('django.conf',), > > > } > > > But this doesn't work. I tried: > > > js_info_dict = { > > 'packages': ('project_name',), > > > } > > > As this is package name for the project directory, but no dice. So how > > do I access the strings in my project directory? > > > Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: return number instead of string in admin
Alan, This is simple python string formatting. You may refer to the following for more details: http://docs.python.org/library/stdtypes.html#string-formatting Thanks, Subhranath Chunder. On Wed, Jul 14, 2010 at 5:31 PM, alan-l wrote: > brilliant, thank you. > > is there a python or django page that layouts all the available > options that can be after the percentage and what they mean? > > > Thanks, > > Alan > > On Jul 14, 11:35 am, Subhranath Chunder wrote: > > Try this instead: > > > > def __unicode__(self): > >return u"%d" % (self.mynumber, ) > > > > On Wed, Jul 14, 2010 at 3:57 PM, Nuno Maltez > wrote: > > > Hi, > > > > > Why not > > > > > def __unicode__(self): > > >return u"%d" % self.mynumber > > > > > ? > > > > > Nuno > > > > > On Wed, Jul 14, 2010 at 11:15 AM, alan-l > > > wrote: > > > > Hi, > > > > > > in the tutorial i see that to return a string or a combination of > > > > strings, i can do: > > > >def __unicode__(self): > > > >return u'%s %s' % (self.firstname, self.surname) > > > > > > what do i need to do to return a number? or more importantly, what is > > > > the def called to ensure it is read and returned when looking at the > > > > class in admin? > > > > > > Thanks, > > > > > > Alan > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups > > > "Django users" group. > > > > To post to this group, send email to django-us...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com > > > > > > . > > > > For more options, visit this group at > > >http://groups.google.com/group/django-users?hl=en. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Django users" group. > > > To post to this group, send email to django-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com > > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
What is djangojs.pot?
I'm getting an error during makemessages: Making project level Javascript strings processing language fr Error: errors happened while running msgmerge msgmerge: input file doesn't contain a header entry with a charset specification If I look in project/locale/fr/LC_MESSAGES I see a file djangojs.pot. What is a .pot file and why is it created? It's not in the documentation. it contains an interesting line: #: static/js/test.js:408 static/js/test.js.py:631 The file static/js/test.js.py does not exist. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Redefine True and False for Boolean and/or NullBoolean Fields?
As I understand, in Django/Python, True is 1 and False=0. And when connected to the database, we use a TinyInt for that variable and assign it to a NullBooleanField. Problem is that some people use their PC's with a Microsoft Access based front end to the database (MySQL). The forms use check-boxes, and when checked, which is supposed be "true", Access puts -1 into the data base. Django doesn't recognize that value as True. I can't change the Access forms or system and don't tell me to stop using Access. We don't have unlimited resources to fix all the problems in the world! I'm wondering if there is some way to tell Django in the data model to let a model variable return True when <>0 (instead of when=1) , and False when 0? This seems the cleanest easiest way; but I can't see how to make this possible? Is it? Or is there another approach ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django Install - Won't Import?
I'm trying to install Django on my laptop but it's not wanting to import through the command line. I pointed to the "setup.py install" but when I try this notepad comes up with some code and that's it. I go and check my Python directory and there are no Django files in there. Any ideas? Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Form validation and template errors - need n00b help
Great, Tom I looked a the django book carefully and did the following: return render_to_response('listing.html', {'form':form,'error': True}) and works... thanks for responding as well On Jul 14, 7:37 am, Tom Evans wrote: > On Tue, Jul 13, 2010 at 4:06 PM, reduxdj wrote: > > HI, > > > Forgive me, here's another n00b doozie. I've created a form, which > > extends form, however, my form is not validating and I can't get the > > form to print errors next to my form fields. What's curious, at the > > form.is_valid() > > in all the examples, I don't see an else: clause. Which leads me to > > believe that a validation error should be > > raised at this point, so an else is not neccessary?? > > > So, my form should hold clean_fieldname methods for each field name > > correct? and if an error is raised, > > automagically, django handles the error messages, as long as it's > > defined in my template, correct or not? > > So every property needs a clean method? > > > Sorry, I've read the resources and I'm a little unclear on this? > > > Thanks for your time, > > Django and the community rocks > > > from my views: > > > def listing(request): > > if request.method == 'POST': # If the form has been submitted... > > new_listing = Listing() > > form = ListingForm(data=request.POST,instance=new_listing) > > #form.save() > > if form.is_valid(): # All validation rules pass > > form.save() > > return HttpResponseRedirect('/listing/') # Redirect after > > POST > > #else: > > #return HttpResponseRedirect('/listing/') # Redirect after > > POST > > #return HttpResponse('form is a failure, like you.') > > #return HttpResponseRedirect('/create/') # Redirect after > > POST > > else: > > form = ListingForm() # An unbound form > > return render_to_response('listing.html', { > > 'form': form, > > }) > > Unindent the 'return render_to_response(...' lines, so that they are > executed when you have an invalid form. The form will be re-rendered, > except this time the form instance will be bound, and have appropriate > error messages in it. > > eg: > > if request.method == 'POST': > form = ... > if form.is_valid(): > ... > else: > form = ... > return render_to_response(...) > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
Nick, thank you so much for figuring this out!! On Jul 8, 11:12 am, Nick Raptis wrote: > In firefox, check your preffered language settings, in the content tab. > > If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" > or something) instead of a locale like en-US, > some django pages won't ever display. > > Nick > > On 07/08/2010 04:11 PM, eon wrote: > > > Same for me. The problem is in the firefox profile (maybe due to the > > switch from 3.5 to 3.6 ?) > > > Start-up with a new profile (backport plugins, bookmarks argh...) > > resolves the issue > > > On 5 juil, 20:52, Andi wrote: > > >> On Jul 2, 10:44 pm, Bill Freeman wrote: > > >>> What might be of help is adding the IP address to /etc/hosts, if you are > >>> on linux. > > >> I have the same problem regarding djangoproject.com (Firefox 3.6.6 on > >> Ubuntu). Everything works but Firefox using my default profile: host > >> and nslookup succeed in resolving the domain name. Adding the IP to / > >> etc/hosts or accessing the IP address directly in firefox doesn't > >> help. Opera, chromium, arora, w3m, elinks, lynx and konqueror are not > >> affected. Firefoxes on other hosts within the same LAN can connect to > >> djangoproject.com without a problem. Disabling all add-ons living in > >> my Firefox doesn't have an effect -- but starting with a fresh profile > >> does: djangoproject.com loads successfully. > > >> It's a very strange problem, because there is no problem with the > >> other thousands of websites I've visited during the last days. It's > >> the combination djangoproject.com + my main Firefox profile which > >> produces the problem exclusively. > > >> -- > >> Andi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin Model Validation on ManyToMany Field
Thank you for your reply. Yes I have selected a user and folder. I believe ManyToMany fields are always optional (hence many to many). So my users and company fields are optional, but my folder field isn't. When I add a new Application in the Admin I do specify a folder and users (if I don't I would at least get a 'Required field' error for the folder field). I've tested the method above (clean function) with another model that has a manytomany field, and it does exactly the same thing, even when I really do fill in the data. In fact, if I delibirately throw an error and look in the debug info I can see the ManyToMany field data being present in the POST data, just like I can when I do the same thing with the above models. Btw, I just noticed a typo in my Folder model description above, that's not the issue as it's correct in my original model. On Jul 14, 2:02 pm, Nuno Maltez wrote: > Hi, > > Just a guess: have you actually selected a user and a folder when > submitting the form? I think only valid field are present on the > cleaned_data dict, and your users and folder fields are not optional > (blank=True, null=True). > > hth, > nuno > > On Tue, Jul 13, 2010 at 1:45 PM, Heleen wrote: > > Hello, > > > I have the following classes: > > class Application(models.Model): > > users = models.ManyToManyField(User, through='Permission') > > folder = models.ForeignKey(Folder) > > > class Folder(models.Model): > > company = models.ManyToManyField(Compnay) > > > class UserProfile(models.Model): > > user = models.OneToOneField(User, related_name='profile') > > company = models.ManyToManyField(Company) > > > Now when I save application, I would like to check if the users do not > > belong to the application's folder's companies. > > I have posed this question before and someone came up with the > > following sollution: > > forms.py: > > class ApplicationForm(ModelForm): > > class Meta: > > model = Application > > > def clean(self): > > cleaned_data = self.cleaned_data > > users = cleaned_data['users'] > > folder = cleaned_data['folder'] > > if > > users.filter(profile__company__in=folder.company.all()).count() > 0: > > raise forms.ValidationError('One of the users of this > > Application works in one of the Folder companies!') > > return cleaned_data > > > admin.py > > class ApplicationAdmin(ModelAdmin): > > form = ApplicationForm > > > This seems like right the way to go about this. The problem is that > > neither the users nor folder fields are in the cleaned_data and I get > > a keyerror when it hits the users = cleaned_data['users'] line. > > > I was hoping that someone here could explain to me why these > > manytomany fields don't show up in cleaned_data and that someone could > > possibly give me a sollution to my problem. > > > Thanks! > > Heleen > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
google blogger & ooyala video integration (apps)
Hi all, I have been working on a number of projects here at u-dox.com, we're a very heavy django shop and have been mindful to try and keep as much of the code generic as possible. A few things which I have written that might be useful to others are two fairly standalone apps - one for syncing and using google blogger content via its RSS feeds for any profile and another to integrate with the Ooyala video hosting platform. Both projects are available at github for anyone interested. The ooyala project can be used without django itself. Both are continuing works but they are at a point I feel I can share them. Blogger: http://github.com/jaymzcd/django-blogger Ooyala: http://github.com/jaymzcd/django-ooyala More info on both: http://jaymz.eu/2010/07/integrating-ooyala-in-django-or-in-general/ http://jaymz.eu/2010/06/google-blogger-to-django-integration/ Cheers, jaymz -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Managing static content / basically handling images best practices
I want to use ImageField for users to upload static content and I need a little advice from a some django pros on how to do this in a dev enviornment. I notice the disclaimer that django dev server should not used to serve static content, or it shouldn't be. So... What's the best practice for this then? Right now, I love the simplicity of the django dev webserver, should i switch the devserver to nginx? Does that have the ability to know when i make a change to a python file without a server restart necessary? Is there anything else I should know. Thanks so much, Patrick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin Model Validation on ManyToMany Field
Sorry, I can't reproduce your error with django 1.2. I copied your models (just removed the intermediaty "Permission" because I don't know your User model) into a new app and I have 2 scenarios Adding an Application in the admin: a) if I select a User and Folder, the validation runs just fine b) if I do not select an User, then the "clean" method is still accessed, but since 'users' is not present in the cleaned_data dict it throws an exception - which is the scenario you give, hence my original guess :) Nuno On Wed, Jul 14, 2010 at 2:32 PM, Heleen wrote: > Thank you for your reply. > > Yes I have selected a user and folder. > I believe ManyToMany fields are always optional (hence many to many). > So my users and company fields are optional, but my folder field > isn't. > When I add a new Application in the Admin I do specify a folder and > users (if I don't I would at least get a 'Required field' error for > the folder field). > I've tested the method above (clean function) with another model that > has a manytomany field, and it does exactly the same thing, even when > I really do fill in the data. In fact, if I delibirately throw an > error and look in the debug info I can see the ManyToMany field data > being present in the POST data, just like I can when I do the same > thing with the above models. > > Btw, I just noticed a typo in my Folder model description above, > that's not the issue as it's correct in my original model. > > On Jul 14, 2:02 pm, Nuno Maltez wrote: >> Hi, >> >> Just a guess: have you actually selected a user and a folder when >> submitting the form? I think only valid field are present on the >> cleaned_data dict, and your users and folder fields are not optional >> (blank=True, null=True). >> >> hth, >> nuno >> >> On Tue, Jul 13, 2010 at 1:45 PM, Heleen wrote: >> > Hello, >> >> > I have the following classes: >> > class Application(models.Model): >> > users = models.ManyToManyField(User, through='Permission') >> > folder = models.ForeignKey(Folder) >> >> > class Folder(models.Model): >> > company = models.ManyToManyField(Compnay) >> >> > class UserProfile(models.Model): >> > user = models.OneToOneField(User, related_name='profile') >> > company = models.ManyToManyField(Company) >> >> > Now when I save application, I would like to check if the users do not >> > belong to the application's folder's companies. >> > I have posed this question before and someone came up with the >> > following sollution: >> > forms.py: >> > class ApplicationForm(ModelForm): >> > class Meta: >> > model = Application >> >> > def clean(self): >> > cleaned_data = self.cleaned_data >> > users = cleaned_data['users'] >> > folder = cleaned_data['folder'] >> > if >> > users.filter(profile__company__in=folder.company.all()).count() > 0: >> > raise forms.ValidationError('One of the users of this >> > Application works in one of the Folder companies!') >> > return cleaned_data >> >> > admin.py >> > class ApplicationAdmin(ModelAdmin): >> > form = ApplicationForm >> >> > This seems like right the way to go about this. The problem is that >> > neither the users nor folder fields are in the cleaned_data and I get >> > a keyerror when it hits the users = cleaned_data['users'] line. >> >> > I was hoping that someone here could explain to me why these >> > manytomany fields don't show up in cleaned_data and that someone could >> > possibly give me a sollution to my problem. >> >> > Thanks! >> > Heleen >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Django users" group. >> > To post to this group, send email to django-us...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users+unsubscr...@googlegroups.com. >> > For more options, visit this group >> > athttp://groups.google.com/group/django-users?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Redefine True and False for Boolean and/or NullBoolean Fields?
On Wed, Jul 14, 2010 at 1:45 PM, rmschne wrote: > As I understand, in Django/Python, True is 1 and False=0. And when > connected to the database, we use a TinyInt for that variable and > assign it to a NullBooleanField. True and False are global objects of type bool, not 1 and 0. bool constructor converts integers to True/False as appropriate. > > Problem is that some people use their PC's with a Microsoft Access > based front end to the database (MySQL). The forms use check-boxes, > and when checked, which is supposed be "true", Access puts -1 into the > data base. Django doesn't recognize that value as True. Yes, Access is dire. I think you can probably count the number of people using Access as a front end to django on one hand (possibly one hand with four fingers cut off). > > I can't change the Access forms or system and don't tell me to stop > using Access. We don't have unlimited resources to fix all the > problems in the world! > > I'm wondering if there is some way to tell Django in the data model to > let a model variable return True when <>0 (instead of when=1) , and > False when 0? > > This seems the cleanest easiest way; but I can't see how to make this > possible? Is it? Or is there another approach ? > Define a MyBooleanField that extends models.BooleanField, override to_python(). Use that instead of models.BooleanField. Docs on that: http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/ Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dynamic Form Widget [django admin]
Hi guys, This might be best explained by example... for the following model: class Setting(models.Model): data_type = models.CharField() value = models.TextField() I want Django's admin to display a different form widget for the "value" field depending on the input of "data_type". For example: if "data_type" was "date", then the value field would use a date widget instead of the TextField's default widget. My predicament is that ModelAdmin is defined as a class, and not instances. So I can't pass it a custom form since instances (i.e. "data_type" value) are needed to decide what field the form should have... Any help would be greatly appreciated! thanks, Jon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Managing static content / basically handling images best practices
I solved this issue by making the FileField (or ImageField) save the files into an Apache (or other web server) served directory. Though obviously this has security implications so I only do this for the password protected admin. Hope that helps cheers, Jon On Jul 15, 12:33 am, reduxdj wrote: > I want to use ImageField for users to upload static content and I need > a little advice from a some django pros on how to do this in a dev > enviornment. I notice the disclaimer that django dev server should not > used to serve static content, or it shouldn't be. So... > > What's the best practice for this then? > Right now, I love the simplicity of the django dev webserver, should i > switch the devserver to nginx? > Does that have the ability to know when i make a change to a python > file without a server restart necessary? > Is there anything else I should know. > > Thanks so much, > Patrick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin Model Validation on ManyToMany Field
On Wed, Jul 14, 2010 at 3:50 PM, Nuno Maltez wrote: > Sorry, I can't reproduce your error with django 1.2. > > I copied your models (just removed the intermediaty "Permission" > because I don't know your User model) into a new app and I have 2 Oops, forgot to add i made the ManyToMany a relation to django's User model. Nuno -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Managing static content / basically handling images best practices
I typically add a config to apache to ignore my media folder and not handle it with python so that requests to /media/.* all go straight to the webserver and don't go via django. I typically have something like this sitting in my conf's: SetHandler None Options -Indexes I'd not bother doing that for the dev environment though unless you've got your server setup already and its not much hassle. jaymz On Jul 14, 3:33 pm, reduxdj wrote: > I want to use ImageField for users to upload static content and I need > a little advice from a some django pros on how to do this in a dev > enviornment. I notice the disclaimer that django dev server should not > used to serve static content, or it shouldn't be. So... > > What's the best practice for this then? > Right now, I love the simplicity of the django dev webserver, should i > switch the devserver to nginx? > Does that have the ability to know when i make a change to a python > file without a server restart necessary? > Is there anything else I should know. > > Thanks so much, > Patrick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin Model Validation on ManyToMany Field
Hi Heleen, I think this is because your running the users through an intermediate model. That changes the way you need to work with the M2M data. You should be working on the Permission model/objects instead. If you check out the M2M docs for models via an intermediate: http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships You'll see the example is pretty much what you have only with Group instead of Application. "The only way to create this type of relationship is to create instances of the intermediate model. Unlike normal many-to-many fields, you can't use add, create, or assignment (i.e., beatles.members = [...]) to create relationships:" jaymz On Jul 14, 2:32 pm, Heleen wrote: > Thank you for your reply. > > Yes I have selected a user and folder. > I believe ManyToMany fields are always optional (hence many to many). > So my users and company fields are optional, but my folder field > isn't. > When I add a new Application in the Admin I do specify a folder and > users (if I don't I would at least get a 'Required field' error for > the folder field). > I've tested the method above (clean function) with another model that > has a manytomany field, and it does exactly the same thing, even when > I really do fill in the data. In fact, if I delibirately throw an > error and look in the debug info I can see the ManyToMany field data > being present in the POST data, just like I can when I do the same > thing with the above models. > > Btw, I just noticed a typo in my Folder model description above, > that's not the issue as it's correct in my original model. > > On Jul 14, 2:02 pm, Nuno Maltez wrote: > > > > > Hi, > > > Just a guess: have you actually selected a user and a folder when > > submitting the form? I think only valid field are present on the > > cleaned_data dict, and your users and folder fields are not optional > > (blank=True, null=True). > > > hth, > > nuno > > > On Tue, Jul 13, 2010 at 1:45 PM, Heleen wrote: > > > Hello, > > > > I have the following classes: > > > class Application(models.Model): > > > users = models.ManyToManyField(User, through='Permission') > > > folder = models.ForeignKey(Folder) > > > > class Folder(models.Model): > > > company = models.ManyToManyField(Compnay) > > > > class UserProfile(models.Model): > > > user = models.OneToOneField(User, related_name='profile') > > > company = models.ManyToManyField(Company) > > > > Now when I save application, I would like to check if the users do not > > > belong to the application's folder's companies. > > > I have posed this question before and someone came up with the > > > following sollution: > > > forms.py: > > > class ApplicationForm(ModelForm): > > > class Meta: > > > model = Application > > > > def clean(self): > > > cleaned_data = self.cleaned_data > > > users = cleaned_data['users'] > > > folder = cleaned_data['folder'] > > > if > > > users.filter(profile__company__in=folder.company.all()).count() > 0: > > > raise forms.ValidationError('One of the users of this > > > Application works in one of the Folder companies!') > > > return cleaned_data > > > > admin.py > > > class ApplicationAdmin(ModelAdmin): > > > form = ApplicationForm > > > > This seems like right the way to go about this. The problem is that > > > neither the users nor folder fields are in the cleaned_data and I get > > > a keyerror when it hits the users = cleaned_data['users'] line. > > > > I was hoping that someone here could explain to me why these > > > manytomany fields don't show up in cleaned_data and that someone could > > > possibly give me a sollution to my problem. > > > > Thanks! > > > Heleen > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Django users" group. > > > To post to this group, send email to django-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com. > > > For more options, visit this group > > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Redefine True and False for Boolean and/or NullBoolean Fields?
Tom, Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Comparing DateTimeField to datetime.now()
This is my model, I'm trying to set it so that if the game is in the future, based on the field date, then to return True, if not return False. http://dpaste.com/218111/ I am importing datetime in my models.py but for some reason it's giving me nothing. I tried displaying future and nothing shows up? What have I done wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django Install - Won't Import?
Sounds like you're quite new to all this. If I was you I'd install setuptools for windows, it'll make adding packages a lot easier for you. http://thinkhole.org/wp/2007/02/01/howto-install-setuptools-in-windows/ The "setup.py install" command, you should have "python" before that so it actually executes. You can of course always just extract the django source code and drop it in your python packages also. If you execute "python" at the command line and try "import django" it should work. I haven't tried installing python etc on windows for a couple of years but my collegue found this guide useful for setting up his django install on vista: http://i.justrealized.com/2008/04/08/how-to-install-python-and-django-in-windows-vista/ jaymz On Jul 14, 1:46 pm, Hayezb wrote: > I'm trying to install Django on my laptop but it's not wanting to > import through the command line. I pointed to the "setup.py install" > but when I try this notepad comes up with some code and that's it. I > go and check my Python directory and there are no Django files in > there. > > Any ideas? > > Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Managing static content / basically handling images best practices
Not sure if I understood the question, but here goes: Are you using the devserver on production? If you are, stop! It's perfectly fine to serve the static media via the dev server in a *DEV* environment. Here's some information: http://docs.djangoproject.com/en/dev/howto/static-files/#limiting-use-to-debug-true You will however encounter problems since your users won't upload their content to your DEV env, they will upload it to the production environment. You could either use something like rsync to sync the folders to your harddrive from the server. Another approach is to use something like this: http://github.com/sunlightlabs/django-mediasync nginx is great for serving static media but might add some complexity to your server setup, apache+mod_wsgi is the recommended choice by the documentation, and works really well for sites that dsn't receive huge amount of traffic. You would just specify a directory to use for static content in your apache config and make mod_wsgi handle everything else. The django and mod_wsgi docs have great articles on this. Good luck with your server setup. Best, Anders Petersson On Jul 14, 4:33 pm, reduxdj wrote: > I want to use ImageField for users to upload static content and I need > a little advice from a some django pros on how to do this in a dev > enviornment. I notice the disclaimer that django dev server should not > used to serve static content, or it shouldn't be. So... > > What's the best practice for this then? > Right now, I love the simplicity of the django dev webserver, should i > switch the devserver to nginx? > Does that have the ability to know when i make a change to a python > file without a server restart necessary? > Is there anything else I should know. > > Thanks so much, > Patrick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Comparing DateTimeField to datetime.now()
On Jul 14, 4:43 pm, Chris McComas wrote: > This is my model, I'm trying to set it so that if the game is in the > future, based on the field date, then to return True, if not return > False. > > http://dpaste.com/218111/ > > I am importing datetime in my models.py but for some reason it's > giving me nothing. I tried displaying future and nothing shows up? > What have I done wrong? How/where are you calling this method? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Comparing DateTimeField to datetime.now()
This code works fine for me: In [1]: from gallery.models import Gallery In [2]: g = Gallery.objects.all()[0] In [3]: g.created_at Out[3]: datetime.datetime(2010, 4, 1, 7, 11, 51) In [4]: import datetime In [5]: n = datetime.datetime.now() In [6]: g.created_at > n Out[6]: False In [7]: [g.created_at, n] Out[7]: [datetime.datetime(2010, 4, 1, 7, 11, 51), datetime.datetime(2010, 7, 14, 8, 53, 22, 960271)] Are you sure your self.date has been initialized and isn't None? On Jul 14, 4:43 pm, Chris McComas wrote: > This is my model, I'm trying to set it so that if the game is in the > future, based on the field date, then to return True, if not return > False. > > http://dpaste.com/218111/ > > I am importing datetime in my models.py but for some reason it's > giving me nothing. I tried displaying future and nothing shows up? > What have I done wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Comparing DateTimeField to datetime.now()
I'm using it in my template... Basically this http://dpaste.com/218114/ Mainly I want to use it for the {% if %} but I tried to just show it was well and still nothing... On Jul 14, 11:49 am, Daniel Roseman wrote: > On Jul 14, 4:43 pm, Chris McComas wrote: > > > This is my model, I'm trying to set it so that if the game is in the > > future, based on the field date, then to return True, if not return > > False. > > >http://dpaste.com/218111/ > > > I am importing datetime in my models.py but for some reason it's > > giving me nothing. I tried displaying future and nothing shows up? > > What have I done wrong? > > How/where are you calling this method? > -- > DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: allow users who are not logged in to submit data first and then log in or register
Hi, On Tue, Jul 13, 2010 at 8:29 PM, Continuation wrote: > I have a data submission form that is visible to everyone, but a user > must be registered & logged in before the data can be submitted > > I want to allow users who are not logged in to submit data through > the form first, and then ask him to either register or log in. After > the registration/login process is finished, the data submitted by that > user would then be saved to the DB. > > What's the best way to achieve that? It doesn't seem like the > @login_required decorator would work because the initial data > submitted by the user wouldn't be preserved by @login_required. > > Is there a decorator similar to @login_required but would do what I > want? > > Thanks. > > After submitting the form if its valid save it to session and redirect the user to the view that saves it but it has the @login_required decorator. lzantal > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Valid objects are returning an http 404 response
Sorry to be so slow in responding. We were able to turn debugging on... and no one saw a 404 error with debugging on. Of course, debugging took a toll on the database server so we were not able to just leave it on. We have audited our code and we were able to clean up quite a bit but we do see this problem still, but with less frequency. If we get to the bottom of it, I can post what we did to fix it. On Jul 1, 2:38 pm, Bill Freeman wrote: > I may be just living under a rock, but I don't know how to use > pdb.set_trace() when not using the development server. If you do this > successfully, please let me know. > > What I have done is append "print"ings to a file, or configure extra > logger outputs. Under mod_wsgi I get some logging output in the > apache logs without doing anything special, I don't know how it works > with FCGI. > > Since you say this is an internal tool, you might try DEBUG=True in > settings.py and getting users to come look at their404screens, since > they will then carry extra info. > > > > On Thu, Jul 1, 2010 at 10:41 AM, vjimw wrote: > > It only happens in our production environment. We have a stage > > environment, which is a mirror of production, that does not have this > > behavior and it does not happen on our development or local > > environments. The trace is a good idea to try to see more > > information. > > > On Jul 1, 9:28 am, Bill Freeman wrote: > >> Does it happen when running the development server? If so, you get > >> a lot more debugging info right up front (access to variables in each > >> stack from, for instance). If it's still not clear you can use the trace > >> as a guide as to where to put a pdb.set_trace() (possibly in an if that > >> makes it only trigger in the interesting circumstance) so that you can > >> poke around. > > >> On Thu, Jul 1, 2010 at 10:06 AM, vjimw wrote: > >> > Actually, we are getting our Django404page. Sorry to be unclear on > >> > that. The URLs appears as404in the access logs. > > >> > We are actually using fast_cgi per our system administrator and > >> > wondered if switching to mod_wsgi might help solve the problem, but it > >> > looks like you had the issue with mod_wsgi! > > >> > Did recompiling apache solve the problem for you with your Django app > >> > running mod_wsgi? > > >> > Thanks for the fast response. Let me know any other information that > >> > my be helpful. > > >> > On Jul 1, 9:00 am, "euan.godd...@googlemail.com" > >> > wrote: > >> >> When you say "an apache404error" do you mean a non-Django styled > >> >> one? If so, I think there's something wrong with your apache > >> >> configuration and not your Django app. What mechanism are you using to > >> >> serve the application? I have seen issues like with this mod_wsgi when > >> >> the reload mechanism isn't triggered correctly and you have to restart > >> >> apache to get it work correctly. I think in that case it was because > >> >> I'd compiled apache slightly incorrectly. I never got to the bottom of > >> >> the problem. > > >> >> On Jul 1, 2:54 pm, vjimw wrote: > > >> >> > We are having an issue where valid model objects are returning an > >> >> > apache404error. Often times, if you hit refresh in the browser a few > >> >> > times, the object is returned with the same URL. > > >> >> > We are using Django 1.2.1 > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "Django users" group. > >> > To post to this group, send email to django-us...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > django-users+unsubscr...@googlegroups.com. > >> > For more options, visit this group > >> > athttp://groups.google.com/group/django-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dynamic Form Widget [django admin]
Hi, On Wed, Jul 14, 2010 at 7:51 AM, Jon Walsh wrote: > Hi guys, > > This might be best explained by example... for the following model: > > class Setting(models.Model): >data_type = models.CharField() >value = models.TextField() > > I want Django's admin to display a different form widget for the > "value" field depending on the input of "data_type". For example: if > "data_type" was "date", then the value field would use a date widget > instead of the TextField's default widget. > > My predicament is that ModelAdmin is defined as a class, and not > instances. So I can't pass it a custom form since instances (i.e. > "data_type" value) are needed to decide what field the form should > have... > > Any help would be greatly appreciated! > > thanks, Jon > > If I understand you good how about using javascript to check what kind of info you enter into the data_type field and it would update the value input field. Using jquery it would be very easy to implement. lzantal > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Comparing DateTimeField to datetime.now()
How did u import the datetime module? If you did: a> import datetime Then, use 'datetime.datetime.now()' instead of 'datetime.now()' b> from datetime import datetime Then 'datetime.now()' should work correctly. Thanks, Subhranath Chunder. On Wed, Jul 14, 2010 at 9:13 PM, Chris McComas wrote: > This is my model, I'm trying to set it so that if the game is in the > future, based on the field date, then to return True, if not return > False. > > http://dpaste.com/218111/ > > I am importing datetime in my models.py but for some reason it's > giving me nothing. I tried displaying future and nothing shows up? > What have I done wrong? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Adding object via m2m relationship in save() method -problem
Hello! I have a problem which i can't solve on my own. I have already searched the web, but without success. I have the following two models which are related with a many to many relationship using Django 1.1 with Postgres on Unix: FIELD_TYPES = ( (u'int',u'int'), (u'string',u'string'), ) class MediaAttribute(models.Model): attribute = models.CharField(max_length=100) value = models.CharField(max_length=100) type = models.CharField(max_length=30, choices=FIELD_TYPES, default='string') def __str__(self): return self.attribute + "=" + self.value class MediaItem(models.Model): # inspired by the ImageModel of photologue id = models.AutoField(primary_key=True) file = models.FileField(upload_to='uploads/archive/') view_count = models.PositiveIntegerField(default=0, editable=False) created_at = models.DateField(auto_now=True) updated_at = models.DateField(auto_now=True) attributes = models.ManyToManyField(MediaAttribute,blank=True) def __str__(self): return self.file.name def create_or_update_attribute(self,the_attribute,the_value,the_type='string'): ''' Updates or adds an attribute of a mediaItem. ''' related_attribute = self.attributes.filter(attribute=the_attribute,value=the_value) if related_attribute: return related_attribute = self.attributes.filter(attribute=the_attribute) if related_attribute.count() is not 0: for attribute in related_attribute: self.attributes.remove(attribute) MediaAttribute_object, created = MediaAttribute.objects.get_or_create(attribute=the_attribute,value=the_value,type=the_type) self.attributes.add(MediaAttribute_object) self.low_level_save() return MediaAttribute_object def save(self, *args, **kwargs): super(MediaItem, self).save(*args, **kwargs) current_photgrapher = 'photographer name' self.create_or_update_attribute('photographer', current_photgrapher) I want to associate keywords with a mediaitem, but in a loose and dynamic way since many photos share the same attributes as photographer for example. i want to save the photographer's name at the beginning after the mediaItem object has been created. The strange thing is, that when i call the function create_or_update_attribute from within save(). There is no error message and also a new MediaAttribute is properly created, but it's not connected with the MediaAttribute in the database. The function "create_or_update_attribute" works correct when called outside the save function (e.g. from a view). Then a connection between the MediaItem and the MediaAttribute is made correctly. Like so: m,c = MediaItem.objects.get_or_create(pk=1) m.create_or_update_attribute('photographer','test') (this works correct. it creates a new MediaAttribue and makes also a connection to the MediaAttribue in the Database.) Can anybody help me? I would appreciate any advice! Thank you very much, Frederic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unknown command: graph_models
On Wed, Jul 14, 2010 at 6:55 AM, Pedram wrote: > Hello, > Sorry if this thread already exists. I've searched but nothing could > find. > I tried this code: > python manage.py graph_models graphdb -o scheme.dot > But I got this error: > Unknown command: 'graph_models' > Type 'manage.py help' for usage. > > I installed python-graphviz, graphviz-deb, python-django-extensions > but still I have the error. Anything's missing? Did you added django_extensions to your INSTALLED_APPS? If you run "manage.py help" you should see graph_models in the command list. ~Rolando -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Comparing DateTimeField to datetime.now()
This worked: import datetime Then, use 'datetime.datetime.now()' instead of 'datetime.now()' Thanks guys! On Jul 14, 11:57 am, Subhranath Chunder wrote: > How did u import the datetime module? > If you did: > > a> > import datetime > Then, use 'datetime.datetime.now()' instead of 'datetime.now()' > > b> > from datetime import datetime > Then 'datetime.now()' should work correctly. > > Thanks, > Subhranath Chunder. > > On Wed, Jul 14, 2010 at 9:13 PM, Chris McComas wrote: > > > > > This is my model, I'm trying to set it so that if the game is in the > > future, based on the field date, then to return True, if not return > > False. > > >http://dpaste.com/218111/ > > > I am importing datetime in my models.py but for some reason it's > > giving me nothing. I tried displaying future and nothing shows up? > > What have I done wrong? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
problem models.py code
I try this code to create database in using django. file :models.py class amount(models.Model): jono = models.PositiveIntegerField(unique=True) name = models.CharField(max_length=750) receipt = models.CharField(max_length=200) phno = models.CharField(max_length=25) type = models.CharField(max_length=50) rdate = models.DateField('date published') site = models.CharField(max_length=200) after run #python manage.py sql tcc command i get BEGIN; CREATE TABLE `tcc_amount` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `jono` integer UNSIGNED NOT NULL UNIQUE, `name` varchar(750) NOT NULL, `receipt` varchar(200) NOT NULL, `phno` varchar(25) NOT NULL, `type` varchar(50) NOT NULL, `rdate` date NOT NULL, `site` varchar(200) NOT NULL ) ; COMMIT; But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono not include the 'id '. Which code is used to make 'jono ' to auto increment.?? Pleases help ,if possible. thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem models.py code
I'm not exactly sure what you want. So, I'm only assuming that you might be trying to do something like: jono = models.AutoField(unique=True) instead of what you're currently using. Thanks, Subhranath Chunder. On Wed, Jul 14, 2010 at 11:08 PM, Jagdeep Singh Malhi < singh.malh...@gmail.com> wrote: > I try this code to create database in using django. > > file :models.py > class amount(models.Model): > jono = models.PositiveIntegerField(unique=True) > name = models.CharField(max_length=750) > receipt = models.CharField(max_length=200) > phno = models.CharField(max_length=25) > type = models.CharField(max_length=50) > rdate = models.DateField('date published') > site = models.CharField(max_length=200) > > after run > #python manage.py sql tcc > command i get > BEGIN; > CREATE TABLE `tcc_amount` ( >`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, >`jono` integer UNSIGNED NOT NULL UNIQUE, >`name` varchar(750) NOT NULL, >`receipt` varchar(200) NOT NULL, >`phno` varchar(25) NOT NULL, >`type` varchar(50) NOT NULL, >`rdate` date NOT NULL, >`site` varchar(200) NOT NULL > ) > ; > COMMIT; > > But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono > not include the 'id '. > Which code is used to make 'jono ' to auto increment.?? > Pleases help ,if possible. > > thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem models.py code
Are you talking about this: http://www.djangoproject.com/documentation/models/custom_pk/ ?? You must declar jono as: jono = models.PositiveIntergerField(primary_key=True) On Wed, Jul 14, 2010 at 19:38, Jagdeep Singh Malhi wrote: > I try this code to create database in using django. > > file :models.py > class amount(models.Model): > jono = models.PositiveIntegerField(unique=True) > name = models.CharField(max_length=750) > receipt = models.CharField(max_length=200) > phno = models.CharField(max_length=25) > type = models.CharField(max_length=50) > rdate = models.DateField('date published') > site = models.CharField(max_length=200) > > after run > #python manage.py sql tcc > command i get > BEGIN; > CREATE TABLE `tcc_amount` ( >`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, >`jono` integer UNSIGNED NOT NULL UNIQUE, >`name` varchar(750) NOT NULL, >`receipt` varchar(200) NOT NULL, >`phno` varchar(25) NOT NULL, >`type` varchar(50) NOT NULL, >`rdate` date NOT NULL, >`site` varchar(200) NOT NULL > ) > ; > COMMIT; > > But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono > not include the 'id '. > Which code is used to make 'jono ' to auto increment.?? > Pleases help ,if possible. > > thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem models.py code
Are you talking about this: http://www.djangoproject.com/documentation/models/custom_pk/ ?? You must declar jono as: jono = models.PositiveIntergerField(primary_key=True) On Wed, Jul 14, 2010 at 19:38, Jagdeep Singh Malhi wrote: > I try this code to create database in using django. > > file :models.py > class amount(models.Model): > jono = models.PositiveIntegerField(unique=True) > name = models.CharField(max_length=750) > receipt = models.CharField(max_length=200) > phno = models.CharField(max_length=25) > type = models.CharField(max_length=50) > rdate = models.DateField('date published') > site = models.CharField(max_length=200) > > after run > #python manage.py sql tcc > command i get > BEGIN; > CREATE TABLE `tcc_amount` ( >`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, >`jono` integer UNSIGNED NOT NULL UNIQUE, >`name` varchar(750) NOT NULL, >`receipt` varchar(200) NOT NULL, >`phno` varchar(25) NOT NULL, >`type` varchar(50) NOT NULL, >`rdate` date NOT NULL, >`site` varchar(200) NOT NULL > ) > ; > COMMIT; > > But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono > not include the 'id '. > Which code is used to make 'jono ' to auto increment.?? > Pleases help ,if possible. > > thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem models.py code
Just set primary_key=True on your field: jono = models.PositiveIntegerField(primary_key=True) See the django documentation for details: http://docs.djangoproject.com/en/dev/topics/db/models/#id1 Nuno On Wed, Jul 14, 2010 at 6:38 PM, Jagdeep Singh Malhi wrote: > I try this code to create database in using django. > > file :models.py > class amount(models.Model): > jono = models.PositiveIntegerField(unique=True) > name = models.CharField(max_length=750) > receipt = models.CharField(max_length=200) > phno = models.CharField(max_length=25) > type = models.CharField(max_length=50) > rdate = models.DateField('date published') > site = models.CharField(max_length=200) > > after run > #python manage.py sql tcc > command i get > BEGIN; > CREATE TABLE `tcc_amount` ( > `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, > `jono` integer UNSIGNED NOT NULL UNIQUE, > `name` varchar(750) NOT NULL, > `receipt` varchar(200) NOT NULL, > `phno` varchar(25) NOT NULL, > `type` varchar(50) NOT NULL, > `rdate` date NOT NULL, > `site` varchar(200) NOT NULL > ) > ; > COMMIT; > > But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono > not include the 'id '. > Which code is used to make 'jono ' to auto increment.?? > Pleases help ,if possible. > > thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Overriding ModelForm field's value in the admin changeview
Does anyone know where in the admin changeview the fields in a ModelForm is populated with the information from the database? I was hoping to override one of the fields in a subclassed ModelForm.__init__(), e.g.: self.base_fields[field_name].initial = 'foo' But the population appears to be happening farther down the chain, as 'foo' is overwritten with the value from the database. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem models.py code
Sorry, I reply to this mail two times. On Jul 14, 7:47 pm, Alexandre González wrote: > Are you talking about > this:http://www.djangoproject.com/documentation/models/custom_pk/?? > > You must declar jono as: > > jono = models.PositiveIntergerField(primary_key=True) > > On Wed, Jul 14, 2010 at 19:38, Jagdeep Singh Malhi > wrote: > > > > > > > I try this code to create database in using django. > > > file :models.py > > class amount(models.Model): > > jono = models.PositiveIntegerField(unique=True) > > name = models.CharField(max_length=750) > > receipt = models.CharField(max_length=200) > > phno = models.CharField(max_length=25) > > type = models.CharField(max_length=50) > > rdate = models.DateField('date published') > > site = models.CharField(max_length=200) > > > after run > > #python manage.py sql tcc > > command i get > > BEGIN; > > CREATE TABLE `tcc_amount` ( > > `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, > > `jono` integer UNSIGNED NOT NULL UNIQUE, > > `name` varchar(750) NOT NULL, > > `receipt` varchar(200) NOT NULL, > > `phno` varchar(25) NOT NULL, > > `type` varchar(50) NOT NULL, > > `rdate` date NOT NULL, > > `site` varchar(200) NOT NULL > > ) > > ; > > COMMIT; > > > But i want 'jono' is also AUTO_INCREMENT with 'id' or only jono > > not include the 'id '. > > Which code is used to make 'jono ' to auto increment.?? > > Pleases help ,if possible. > > > thanks > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > -- > Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt > and/or .pptxhttp://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
Thanks for the replies. To be clear, I'm not looking for hosting, I'm looking for someone to take it completely off my hands. This means doing whatever you want with it, but I would hope it would at least mean keeping it up to date. This only takes and hour or two whenever a new version of Django is released, but I no longer have any interest in doing it. @Andy - The "build" script is a windows '.bat' file. Basically, you put all the components that comprise Instant Django into a folder, run the '.bat' file, and in builds the Instant Django download. This got a little harder to do after the Python dev's broke the MSI installer. Prior to Python 2.6 you could install Python from the command line into a self-contained temporary directory, without touching the underlying host system. This is no longer possible, and I couldn't convince anyone that mattered that it was a problem. Anyway, I'll email the people who have expressed an interest directly with further details. -CJL -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
I would be quite interested. I use instant django so might work out for me. Thanos On Jul 14, 2010, at 2:48 PM, cjl wrote: Thanks for the replies. To be clear, I'm not looking for hosting, I'm looking for someone to take it completely off my hands. This means doing whatever you want with it, but I would hope it would at least mean keeping it up to date. This only takes and hour or two whenever a new version of Django is released, but I no longer have any interest in doing it. @Andy - The "build" script is a windows '.bat' file. Basically, you put all the components that comprise Instant Django into a folder, run the '.bat' file, and in builds the Instant Django download. This got a little harder to do after the Python dev's broke the MSI installer. Prior to Python 2.6 you could install Python from the command line into a self-contained temporary directory, without touching the underlying host system. This is no longer possible, and I couldn't convince anyone that mattered that it was a problem. Anyway, I'll email the people who have expressed an interest directly with further details. -CJL -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/django-users?hl=en . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Look up model instance by id
How do I look up a model instance by id (its primary key)? I have: entity = directory.models.Entity.objects.filter(id__equals = id)[0] and am getting: FieldError at /profile/1 Join on field 'id' not permitted. Did you misspell 'equals' for the lookup type? Is there another way I should be going about this given the id field beforehand? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Log errors to file
I'm interested and I doubt I'm the only one. On Thu, Jul 8, 2010 at 4:34 AM, euan.godd...@googlemail.com < euan.godd...@gmail.com> wrote: > I have created a decorator for Django views which handles AJAX > tracebacks and sends the traceback back to the AJAX application as > JSON, e.g. > > {'status':'error', 'message': } > > It uses the traceback module to output the full traceback. Obviously > you need to have a handler that receives this data and displays in on > the page (although you can inspect it in firebug). > > If you'd like the code for it, I can ask my company whether they'd be > happy with me publishing it. > > Cheers, Euan > > On Jul 7, 10:35 pm, Jonathan Hayward > wrote: > > I'm working on a view made to output JSON for Ajax use. My log has: > > > > [07/Jul/2010 17:47:13] "POST /ajax/login HTTP/1.1" 500 50678 > > > > That looks like Django gave a helpful and detailed stacktrace page, > albeit > > to jQuery expecting JSON. > > > > How can I ask Django to log uncaught exceptions to a file or equivalent? > The > > test server has no MTA so I can't really ask it to email me exceptions. > > > > TIA, > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Look up model instance by id
Try: directory.models.Entity.objects.get(pk=id) Which does pretty much the same thing as: directory.models.Entity.objects.filter(id__exact = id)[0] (note id__exact rather than id__equals) On Jul 14, 3:18 pm, Jonathan Hayward wrote: > How do I look up a model instance by id (its primary key)? I have: > > entity = directory.models.Entity.objects.filter(id__equals = id)[0] > > and am getting: > > FieldError at /profile/1 > > Join on field 'id' not permitted. Did you misspell 'equals' for the lookup > type? > > Is there another way I should be going about this given the id field > beforehand? > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Look up model instance by id
Thank you; the first seemed to work nicely. On Wed, Jul 14, 2010 at 2:36 PM, ringemup wrote: > Try: > >directory.models.Entity.objects.get(pk=id) > > Which does pretty much the same thing as: > >directory.models.Entity.objects.filter(id__exact = id)[0] > > (note id__exact rather than id__equals) > > > > On Jul 14, 3:18 pm, Jonathan Hayward > wrote: > > How do I look up a model instance by id (its primary key)? I have: > > > > entity = directory.models.Entity.objects.filter(id__equals = id)[0] > > > > and am getting: > > > > FieldError at /profile/1 > > > > Join on field 'id' not permitted. Did you misspell 'equals' for the > lookup type? > > > > Is there another way I should be going about this given the id field > > beforehand? > > > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django 1.2.1, Postgres 8.3 - Cast (text to int) Issue
Hi, Wonder if someone can help. I have a piece of code (filtched from elsewhere) that retrieves the comments for a particular Entry (blog post): Comment.objects.filter(content_type=ContentType.objects.get_for_model(Entry), object_pk__in=Entry.objects.filter(title=self.title)) Problem is, that with Postgres 8.3 (and seemingly Django 1.2.1), this command fails: " django.db.utils.DatabaseError: operator does not exist: text = integer HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. " Having searched around in various forms this appears to be a sort of known problem (see http://code.djangoproject.com/ticket/10015). The issue is that object_py in Comments is a "text" field, whereas the id field in Entry is an int - hence a cast is required. I can make the actual SQL work in Postgres 8.3 by altering the start of the WHERE to be: "WHERE (cast(django_comments.object_pk as int) IN (SELECT" i.e. adding the 'cast'. So, my question is: what's the best way to go about this in Django 1.2.1 with Postgres 8.3? (8.3.8 to be exact). Any thoughts/ recommendations most welcome. FYI - this is for use with Djapian. Thanks, R -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Plain Python traceback (not error page)
I am working on debugging a basic template, and after correcting some other error, I got: Traceback (most recent call last): File "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 245, in __call__ response = middleware_method(request, response) File "/usr/local/lib/python2.6/site-packages/django/contrib/sessions/middleware.py", line 26, in process_response patch_vary_headers(response, ('Cookie',)) File "/usr/local/lib/python2.6/site-packages/django/utils/cache.py", line 127, in patch_vary_headers if response.has_header('Vary'): AttributeError: 'SafeUnicode' object has no attribute 'has_header' This wasn't the usual format for a Django traceback, and the traceback is only in Django code, no reference to my project. Suggestions? Would it make sense to open a bug? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Look up model instance by id
One slight difference: If you need to deal with the object not being found, you get a different error using get as opposed to using filter and then pulling the first element out of the collection. Here's an example, with Location being the model class: try: Location.objects.filter(pk=id)[0] except IndexError: print 'Not found!' # ...handle error here... try: Location.objects.get(pk=id) except Location.DoesNotExist: print 'Not found!' # ...handle error here... Ben On Wed, Jul 14, 2010 at 1:41 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > Thank you; the first seemed to work nicely. > > > On Wed, Jul 14, 2010 at 2:36 PM, ringemup wrote: > >> Try: >> >>directory.models.Entity.objects.get(pk=id) >> >> Which does pretty much the same thing as: >> >>directory.models.Entity.objects.filter(id__exact = id)[0] >> >> (note id__exact rather than id__equals) >> >> >> >> On Jul 14, 3:18 pm, Jonathan Hayward >> wrote: >> > How do I look up a model instance by id (its primary key)? I have: >> > >> > entity = directory.models.Entity.objects.filter(id__equals = id)[0] >> > >> > and am getting: >> > >> > FieldError at /profile/1 >> > >> > Join on field 'id' not permitted. Did you misspell 'equals' for the >> lookup type? >> > >> > Is there another way I should be going about this given the id field >> > beforehand? >> > >> > -- >> > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com >> > → An Orthodox Christian author: theology, literature, et cetera. >> > → My award-winning collection is available for free reading online: >> > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com >> . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> >> > > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Managing static content / basically handling images best practices
This is kind of an aside to your question, but I think you'll find it useful... There are two types of static media that you'll want to have served separately to your dynamic django application: * project static media * uploaded media I like to keep these two separate. My preferred way to do this is to use STATIC_ROOT/STATIC_URL for the project static media, retaining the default MEDIA_* settings for uploaded media only. When using the built-in development server, it is fine to use it to serve your static media. When you shift to a full webservice stack, for your static media you'll make your web service bypass the django wsgi app or use a seperate web service altogether. One final catch is when you need to develop a stand-alone apps which needs to have its own media files. A nice solution to serving all the your static media easily in the dev server, and collating all your app's static media to a single location is http://bitbucket.org/jezdez/django-staticfiles/src On Jul 15, 2:33 am, reduxdj wrote: > I want to use ImageField for users to upload static content and I need > a little advice from a some django pros on how to do this in a dev > enviornment. I notice the disclaimer that django dev server should not > used to serve static content, or it shouldn't be. So... > > What's the best practice for this then? > Right now, I love the simplicity of the django dev webserver, should i > switch the devserver to nginx? > Does that have the ability to know when i make a change to a python > file without a server restart necessary? > Is there anything else I should know. > > Thanks so much, > Patrick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Look up model instance by id
You've also got a shortcut method for the common case of raising 404 if the object doesn't exist: http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#get-object-or-404 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
altering the sessions class
So, I am using request.sessions in one of my views functions but I want to add a few more fields to the Session class so it will be customized for my project. When I tried to go to the Session class (in django.contrib.sessions.models) and simply adding in an extra field, and then adding it to my admin (I put the django_session table to the admin), I got an error saying that attribute didnt exist. My question is, where do I need to make changes so I can add my own fields to the Session class. I also tried having another class inherit the Session class and add fields to the inherited class but the problem I had with that is I couldnt use request.inheritedClass where inheritedClass is the class that inherited the Sessions class. The error I received when I tried doing request.inheritedClass in one of my views function was this: 'WSGIRequest' object has no attribute 'inheritedClass'. To sum it up, can anyone tell me some way to customize the Session class to my liking? Thanks, Tony -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Error with passing 'form_class' arg in urls.py for Django Profiles app
Using ubernostroms Django Registration app coupled with his Profile app, both highly recommended, got the default app up and running no problems at all. I'm unable to override any default behaviour the proper way, as I can't seem to pass any extra parameters through the urls.py file. Here is my urls: from django.conf.urls.defaults import * from profiles import views from django.contrib.auth.decorators import login_required from userinfo.forms import ProfileForm urlpatterns = patterns('', url(r'^edit/$', login_required(views.edit_profile), {'form_class' : ProfileForm}, name='profiles_edit_profile'), url(r'^(?P\w+)/$', login_required(views.profile_detail), name='profiles_profile_detail'), ) I have my custom form class ProfileForm. When I try this I get a stack: Original Traceback (most recent call last): File "/Library/Python/2.5/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/Library/Python/2.5/site-packages/django/template/ defaulttags.py", line 155, in render nodelist.append(node.render(context)) File "/Library/Python/2.5/site-packages/django/template/debug.py", line 87, in render output = force_unicode(self.filter_expression.resolve(context)) File "/Library/Python/2.5/site-packages/django/utils/encoding.py", line 71, in force_unicode s = unicode(s) TypeError: unbound method __unicode__() must be called with ProfileForm instance as first argument (got nothing instead) Now, the docs say to pass in the Class name, and the stack seems to be saying I need an Instance? Whatever extra parameter I pass I get the same error. What am I doing wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to handle Jaywalking - parsing a comma-delimited value in field and do lookups (1,4,5,6...)
One idea that springs to mind is to add a property method to your model that returns that self.group field as a list. With that list you could add another property that returned all the actual group items. Then write a custom admin view for add/change/view of that model which works with the group instead. That way you can leave the data intact but provide a management interface on top. Likewise you can in your front end use your new propertys to work with the groups related to that user. Whatever you do will probably involve a layer of work on top. So in your model I'd add something like: @property def group_list(self): return self.group.split(',') @property def real_groups(self): return Group.objects.all().filter(pk__in=self.group_list) For writing a custom admin view this is to do with something a little different but it's pretty comprehensive in terms of writing a completely custom admin view: http://elo80ka.wordpress.com/2009/10/28/using-a-formwizard-in-the-django-admin/ jaymz On Jul 13, 12:10 pm, Snaky Love wrote: > Hi, > > I have an "interesting" problem here - in a given mysql database > scheme some sql wizard used comma-separated values in a text-field and > with that values lookups have to be done. The data itself is simple > numbers like 1,34,25,66,78,134 and so on. So what I have is something > like this: > > id | username | groups | more... > - > 1 | name | 1,23,4,55,6 | ... > 2 | name2 | 3,2,4,5 | ... > > The groups string can be very long. there is also a table "groups" > with "id, name", as expected. > > Yes, this is bad design. No, I can not immediately change the design, > I will try to, but atm I have to handle the situation as it is. > > Of course normally this would be solved with an intersection table and > a many-to-many relation. For anybody interested: there is a book by > Bill Karwin called "SQL Antipatterns" - he names the described design > Jaywalking and it is the first antipattern in the book. I was > surprised to find it in real life > > So my question is: how to handle this with django? I really would > like to use django to build a nice management interface on top of that > tables, but currently I do not know how to go on with that jaywalking > antipattern in my way. > > My first idea was to create my own intersection table - but the > process of [re-]converting data does only work in a > static environment - the data is heavily used and so > transformations of tabledata would be neccassery on every request to > mirror the live situation...too slow! So I am looking for a good way > to > implement some kind of layer that would translate this field for > django into an intersaection table so that I can use models - will > this work? > > What do you think? How to handle this? > > Thank you very much for your attention! > Snaky -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ordering a model on multiple fields?
is there a way to have a model class sorted on multiple fields? in the meta class of my models I set the ordering, but django uses only the first field for ordering; a second field is just ignored. (I am aware that if a users starts to sort using table headers in the admin interface only one field will be used. It would just be great to have the initial ordering on 2 fields.) kind regards, henk-jan ebbers -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
On 07/14/2010 02:28 PM, Russell Keith-Magee wrote: I'm glad we've worked out that Weave is the culprit, but nobody has answered the question of whether this is an indicator of a problem with Django itself. What is weave passing as a header (and under what conditions) that is causing a problem? Is there a need to improve Django's error handling to protect against this case? Yours, Russ Magee %-) Hi Russ. I hate to admit that I didn't saved that offending value so someone can reproduce this. My reasoning back then for not raising a bug on django was this: 1. It was an obvious invalid value. As I said, Weave probably introduced it at some point (I guess while still in beta) but other than that, it could also be a number of things. Fixing that locale value solves it for good. So I rinsed, wiped, forgot. 2. I tried to access some other django-powered sites with l10n, and they loaded just fine. Only djangoproject.com and djangobook.com had the problem. So my guess was that it was caused by something else on that sites' stack and not django itself. 3. Improving the error-handling of django just didn't cross my mind. I hope someone else with the same problem here could provide you with the offending value. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
PgWest 2010 Call for Papers!
Following on the smashing success of PostgreSQL Conference East, PostgreSQL Conference West, The PostgreSQL Conference for Decision Makers, End Users and Developers, is being held at the St. Francis, Westin Hotel in San Francisco from November 2nd through 4th 2010. Please join us in making this the largest PostgreSQL Conference to date! Main site: http://www.postgresqlconference.org/ CFP: http://www.postgresqlconference.org/2010/west/cfp Thank you to our sponsors: Command Prompt: http://www.commandprompt.com/ EnterpriseDB: http://www.enterprisedb.com/ Time line: July 14th: Talk submission opens Sept 5th: Talk submission closes Sept 10th: Speaker notification This year we will be continuing our trend of covering the entire PostgreSQL ecosystem. We would like to see talks and tutorials on the following topics: * General PostgreSQL: * Administration * Performance * High Availability * Migration * GIS * Integration * Solutions and White Papers * The Stack: * Python/Django/Pylons/TurboGears/Custom * Perl5/Catalyst/Bricolage * Ruby/Rails * Java (PLJava would be great)/Groovy/Grails * Operating System optimization (Linux/FBSD/Solaris/Windows) * Solutions and White Papers -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 Consulting, Training, Support, Custom Development, Engineering -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unknown command: graph_models
On Jul 14, 8:56 pm, Rolando Espinoza La Fuente wrote: > On Wed, Jul 14, 2010 at 6:55 AM, Pedram wrote: > > Hello, > > Sorry if this thread already exists. I've searched but nothing could > > find. > > I tried this code: > > python manage.py graph_models graphdb -o scheme.dot > > But I got this error: > > Unknown command: 'graph_models' > > Type 'manage.py help' for usage. > > > I installed python-graphviz, graphviz-deb, python-django-extensions > > but still I have the error. Anything's missing? > > Did you added django_extensions to your INSTALLED_APPS? > > If you run "manage.py help" you should see graph_models in the command list. > > ~Rolando I added django_extensions and everything's fine. Thank you very much :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
Hi, I had the exact same problem, and I had _not_ installed Weave. The offending config entry in my case was: "chrome://global/locale/intl.properties" and it was at the bottom of the accepted languages list. This is on Firefox 3.6.6 I can reproduce the problem anytime by visiting about:config and changing "intl.accept_languages" to en-nz,en,de,chrome://global/locale/intl.properties *.djangoproject.com will stop responding, (all?) other websites seem fine. Cheers, Danny On Thu, Jul 15, 2010 at 11:52, Nick Raptis wrote: > On 07/14/2010 02:28 PM, Russell Keith-Magee wrote: >> >> I'm glad we've worked out that Weave is the culprit, but nobody has >> answered the question of whether this is an indicator of a problem >> with Django itself. What is weave passing as a header (and under what >> conditions) that is causing a problem? Is there a need to improve >> Django's error handling to protect against this case? >> >> Yours, >> Russ Magee %-) >> >> > > Hi Russ. > I hate to admit that I didn't saved that offending value so someone can > reproduce this. > > My reasoning back then for not raising a bug on django was this: > 1. It was an obvious invalid value. As I said, Weave probably introduced it > at some point (I guess while still in beta) but other than that, it could > also be a number of things. Fixing that locale value solves it for good. So > I rinsed, wiped, forgot. > 2. I tried to access some other django-powered sites with l10n, and they > loaded just fine. Only djangoproject.com and djangobook.com had the problem. > So my guess was that it was caused by something else on that sites' stack > and not django itself. > 3. Improving the error-handling of django just didn't cross my mind. > > I hope someone else with the same problem here could provide you with the > offending value. > > Nick > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Kind regards, Danny W. Adair Director Unfold Limited New Zealand Talk: +64 - 9 - 9555 101 Fax: +64 - 9 - 9555 111 Write: danny.ad...@unfold.co.nz Browse: www.unfold.co.nz Visit/Post: 253 Paihia Road, RD 2, Kawakawa 0282, New Zealand "We are what we repeatedly do. Excellence, therefore, is not an act, but a habit." - Aristotle == Caution The contents of this email and any attachments contain information which is CONFIDENTIAL to the recipient. If you are not the intended recipient, you must not read, use, distribute, copy or retain this email or its attachments. If you have received this email in error, please notify us immediately by return email or collect telephone call and delete this email. Thank you. We do not accept any responsibility for any changes made to this email or any attachment after transmission from us. == -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How can view tweak response object to go to a specific *anchor* on the template?
How can a view tweak the response object so that client sees a specific anchor instead of the top of the page? Chris -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Redefine True and False for Boolean and/or NullBoolean Fields?
Oh ... by the way, we aren't using Access as a front end to Django. There is nothing (far as I know) in Django to front-end to! This app has been successfully making us money for more than 20 years. The data side moved to MySQL a long time ago (can't remember when) to enhance performance and security, but the relatively sophisticated Access side remained in place and continued to evolve. Still see no viable replacement on the horizon for Access for the front end for use by people. There are a number of tools that have suficient capability to replace it but all would cost a fortune to make it happen. Instead, we're using Python/Django as a basis now for enhanced reporting/number-crunching and future automation (which sends us in the direction of having so many people having to use the Access app). Had we had Python and Django in the late 1980's we'd probably be there now. On Jul 14, 3:57 pm, Tom Evans wrote: > On Wed, Jul 14, 2010 at 1:45 PM, rmschne wrote: > > As I understand, in Django/Python, True is 1 and False=0. And when > > connected to the database, we use a TinyInt for that variable and > > assign it to a NullBooleanField. > > True and False are global objects of type bool, not 1 and 0. bool > constructor converts integers to True/False as appropriate. > > > > > Problem is that some people use their PC's with a Microsoft Access > > based front end to the database (MySQL). The forms use check-boxes, > > and when checked, which is supposed be "true", Access puts -1 into the > > data base. Django doesn't recognize that value as True. > > Yes, Access is dire. I think you can probably count the number of > people using Access as a front end to django on one hand (possibly one > hand with four fingers cut off). > > > > > I can't change the Access forms or system and don't tell me to stop > > using Access. We don't have unlimited resources to fix all the > > problems in the world! > > > I'm wondering if there is some way to tell Django in the data model to > > let a model variable return True when <>0 (instead of when=1) , and > > False when 0? > > > This seems the cleanest easiest way; but I can't see how to make this > > possible? Is it? Or is there another approach ? > > Define a MyBooleanField that extends models.BooleanField, override > to_python(). Use that instead of models.BooleanField. > > Docs on that:http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/ > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.