Re: Unable To Delete Records
Thanks Alo On Aug 30, 4:34 pm, Daniel Molina Wegener wrote: > On Tuesday 30 August 2011, > > Showket Bhat wrote: > > Hi All... > > Hello Showket... > > > > > I have created a small application where in i am inserting and > > deleting records. I am able to delete a single record however when a > > select all or more then one record it deletes the last record only.. I > > tried a lot but failed please help I am wring the Code and the Console > > output here > > Probably you should try using: > > m = Medecine.objects.get(pk = i) > > Instead of using: > > m = Medecine.objects.get(id = i) > > Also, try to handle the DoesNotExist and similar exception once you > try to retrieve the object using the /get()/ method. Also you can > reduce the look by using: > > del_ids = request.POST.getlist('del_id') > Medecine.objects.filter(id__in = del_id).delete() > > Which should be faster than your loop. > > > > > > > === > > my function to delete a medecine from its table in views.py > > === > > > def delete_medecine(request,medecine={}): > > print "-->>",request.POST > > list = [] > > for i in request.POST['del_id']: > > m = Medecine.objects.get(id = i) > > m.delete() > > return HttpResponseRedirect('/medecine') > > > == > > my template file > > > > > > > > > > > > > > SNo. > > Name > > Price > > Quantity > > Exp. Date > > Description > > > > > > > > > {% for single in medecine_obj%} > > > > > = "del_id" /> > > {{single.id}} > > {{single.name}} > > {{single.price}} > > {{single.exp_date}} > > {{single.discription}} > > > src="/login/media/assets/action_delete.png" alt="Delete" /> > href="#"> > a> > > > > {%endfor%} > > > > > value = " Add Record " alt="Add" /> > > > alt="Delete" /> > > > > > > > > === > > My Console > > === > > > /usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py:262: > > DeprecationWarning: CsrfResponseMiddleware and CsrfMiddleware are > > deprecated; use CsrfViewMiddleware and the template tag instead (see > > CSRF documentation). > > DeprecationWarning > > == > {u'csrfmiddlewaretoken': [u'fea796e4bc7836bb8584140b71a0afcc'], > > u'del_id': [u'1', u'2', u'8'], u'delete': [u'Delete Records']}> > > = 8 > > [30/Aug/2011 06:04:56] "POST /delete_medecine/ HTTP/1.1" 302 0 > > > == > > > Please help > > Best regards, > -- > Daniel Molina Wegener > System Programmer & Web Developer > Phone: +56 (2) 979-0277 | Blog:http://coder.cl/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Unable to have a template NOT show up
On Wed, 2011-08-31 at 12:05 -0700, Yves S. Garret wrote: > Caught ViewDoesNotExist while rendering: Could not import polls.view. > Error was: No module named view should it not be views? -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
A call for resumes
Seasoned, senior level Python / Django users please contact me for a gig opportunity pr forward your resume. Thanks. Sent from my iPhone -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Combining queries? A "join" in Python?
On Aug 30, 12:10 pm, graeme wrote: > > What my query does is give me a list of subcategories, ordered by > category, and then by the number of places in the category, and > annotates each subcategory with the number of places in it. > > Having a single category model might simplify the query, but as I want > the page to show something like: > > CATEGORY > Subcategory One > Subcategory Two > CATEGORY TWO > Subcategory Three > etc. > I would take a different approach to build this structure. Take advantage of the object model. You could get a list of root categories and send those off to a function (probably a template filter) that builds the html representation you want. If you have the root categories, you have everything you need. root_cats = Category.objects.filter(parent__isnull=True) # gets root categories for cat in root_cats: # iterate thru root categories print "%s (%s)" % (cat.name, cat.texts.count()) # CATEGORY (2) for t in cat.texts.all(): # iterate thru texts that belong to each root category print t for c in cat.children.all(): # iterate thru child categories (one level down from the root) print "%s (%s)" % (c.name, c.texts.count()) # Subcategory One (3) Rework that code to traverse all the way to the bottom (smarter iteration or maybe recursion) and you've got what you need without a complicated query. --Stuart -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Unable to have a template NOT show up
On 31-08-11 22:39, Yves S. Garret wrote: When I said you're right, I meant your insight into my spelling error. That is the one thing that's hard in every web framework: find the spots where something can be wrong when everything *seems* right. Four common spots in django: - Typo in urls.py (like you had). - A circular import. Your models.py imports from views.py and views.py imports from models.py. You get an error like "cannot import yourproject.views", even though ``yourproject/views.py`` is right there before your eyes :-) - A url higher up in the urlpatterns that matches *before* the url you *think* is matching. The url should match perfectly, but you get a strange error because the wrong view is being called. - You're depending on some application in your setup.py's "install_requires" list. The application is installed. Why doesn't it show up? You probably forgot to add it to your INSTALLED_APPS list in your settings.py. At least, that happened to me a few times. "I can import it, why doesn't it work?!?" Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Unable to have a template NOT show up
When I said you're right, I meant your insight into my spelling error. Those are the most annoying errors since they are so difficult to figure out after staring at the screen for so long. On Aug 31, 3:35 pm, Reinout van Rees wrote: > On 31-08-11 21:05, Yves S. Garret wrote: > > > In template c:\python27\lib\site-packages\django\contrib\admin > > \templates\admin\change_list.html, error at line 11 > > Caught ViewDoesNotExist while rendering: Could not import polls.view. > > Error was: No module named view > > Most possible reason that I can think of right now: > > You mis-typed something in your urls.py. I'd expect there to be a > "polls.view" in there instead of the customary "polls.views...", so > with an 's'. > > The module is "views.py", not "view.py". > > Just guessing... > > Reinout > > -- > Reinout van Rees http://reinout.vanrees.org/ > rein...@vanrees.org http://www.nelen-schuurmans.nl/ > "If you're not sure what to do, make something. -- Paul Graham" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Unable to have a template NOT show up
You're right! Thank you. I have another issue with this page and I'll write later (busy with something else.) On Aug 31, 3:35 pm, Reinout van Rees wrote: > On 31-08-11 21:05, Yves S. Garret wrote: > > > In template c:\python27\lib\site-packages\django\contrib\admin > > \templates\admin\change_list.html, error at line 11 > > Caught ViewDoesNotExist while rendering: Could not import polls.view. > > Error was: No module named view > > Most possible reason that I can think of right now: > > You mis-typed something in your urls.py. I'd expect there to be a > "polls.view" in there instead of the customary "polls.views...", so > with an 's'. > > The module is "views.py", not "view.py". > > Just guessing... > > Reinout > > -- > Reinout van Rees http://reinout.vanrees.org/ > rein...@vanrees.org http://www.nelen-schuurmans.nl/ > "If you're not sure what to do, make something. -- Paul Graham" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 setup.py access denies
On 08/31/2011 04:32 PM, Bill Freeman wrote: So far today I've gotten two useless messages from you, and no spams. Don't feed the trolls. I'm sure a moderator will fix this, if they didn't already unsubscribe themselves. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 setup.py access denies
So far today I've gotten two useless messages from you, and no spams. On Wed, Aug 31, 2011 at 4:24 PM, Elie Obeid wrote: > I know how to unsubscribe i don't need your link, I don't trust any of you, > i don't know why this is the official group, this is the official spammers > group > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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 setup.py access denies
I know how to unsubscribe i don't need your link, I don't trust any of you, i don't know why this is the official group, this is the official spammers group -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 setup.py access denies
If you want to unsubscribe, just send an e-mail here: django-users+unsubscr...@googlegroups.com On Wed, Aug 31, 2011 at 4:16 PM, Elie Obeid wrote: > so great I subscribed to OFFICIAL group of django for help and what I > get SPAMS, i'm so delighted!! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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 setup.py access denies
so great I subscribed to OFFICIAL group of django for help and what I get SPAMS, i'm so delighted!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 setup.py access denies
I am having this issue with django http://bit.ly/pTSSyY you could answer it here or there, if you are actually stackoverflow users then answer it there because I opened a 50pts for this question. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Custom Validation on Inline Generic Foreign Key
I went ahead and hardcoded checks for fields that as of today I know will only be in one of the models. I would still love to hear any cleaner solutions if anyone has them. On Aug 26, 10:12 am, John wrote: > Any ideas? > > In the inline model's validation I could hardcode checks for data that > I expect will only be in one of the models, but that does not seem > like the best option. I am still hoping for a simpler alternative to > this. > > 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-users@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: Mystery... Faked Referrer Generates 500 Instead of 404 Error
On 31-08-11 21:19, charris wrote: Hello. I hope someone can provide some clues.I have begun receiving regular 500 errors from a page that does not exist. Without providing the entire error page, here are the essentials: [Django] ERROR (EXTERNAL IP): Internal Server Error:/sample/ path/calendar.pl IOError: request data read error 'HTTP_REFERER': 'http://mydomain.org/calendar.pl', 'PATH_INFO': u'/sample/path/calendar.pl', If I visit the pagehttp://mydomain.org/calendar.pl, I get a 404 error, but the error message referencing the same page generates an internal server (500) error. Some ideas: .pl sounds like a perl script. Perhaps google is hitting your server with now-non-existing urls? Regarding the error 500: can you put your server in debug mode for a couple of minutes? Then you can see the exact error in your browser. (Note that django 1.3 allows you to set up your logging so that those 500 errors end up in the logfile.) The HTTP_REFERER header lists the page the request comes from, so getting a 404 on that page and a 500 on another page isn't strange. Request data read error: perhaps someone is trying to DDOS you: open connections to your webserver but not closing them in an effort to hose your webserver. Django gives a request data read error, perhaps, because the connection stayed open but no data was forthcoming. I don't know about your webserver, but you can probably tell your webserver to immediately tell visitors to those specific pages that the page is gone (apache rewriterule, for instance, with a "410 GONE" response). Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Unable to have a template NOT show up
On 31-08-11 21:05, Yves S. Garret wrote: In template c:\python27\lib\site-packages\django\contrib\admin \templates\admin\change_list.html, error at line 11 Caught ViewDoesNotExist while rendering: Could not import polls.view. Error was: No module named view Most possible reason that I can think of right now: You mis-typed something in your urls.py. I'd expect there to be a "polls.view" in there instead of the customary "polls.views...", so with an 's'. The module is "views.py", not "view.py". Just guessing... Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
Mystery... Faked Referrer Generates 500 Instead of 404 Error
Hello. I hope someone can provide some clues.I have begun receiving regular 500 errors from a page that does not exist. Without providing the entire error page, here are the essentials: [Django] ERROR (EXTERNAL IP): Internal Server Error: /sample/ path/calendar.pl IOError: request data read error 'HTTP_REFERER': 'http://mydomain.org/calendar.pl', 'PATH_INFO': u'/sample/path/calendar.pl', If I visit the page http://mydomain.org/calendar.pl, I get a 404 error, but the error message referencing the same page generates an internal server (500) error. QUESTIONS: Should I be concerned? Why do I get a 500 error instead of 404 error? Any suggestions for troubleshooting? This has been driving me nuts for a few days. Any help is very appreciated. 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-users@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: Unable to have a template NOT show up
This is the current error that I'm getting in my browser: +++ +++ Template error In template c:\python27\lib\site-packages\django\contrib\admin \templates\admin\change_list.html, error at line 11 Caught ViewDoesNotExist while rendering: Could not import polls.view. Error was: No module named view 1 {% extends "admin/base_site.html" %} 2 {% load adminmedia admin_list i18n %} 3 {% load url from future %} 4 {% block extrastyle %} 5 {{ block.super }} 6 7 {% if cl.formset %} 8 9 {% endif %} 10{% if cl.formset or action_form %} 11 {% url 'admin:jsi18n' as jsi18nurl %} 12 13{% endif %} 14{{ media.css }} 15{% if not actions_on_top and not actions_on_bottom %} 16 17#changelist table thead th:first-child {width: inherit} 18 19{% endif %} 20 {% endblock %} 21 +++ +++ Doesn't this part get populated? What am I missing? On Aug 31, 11:23 am, "Yves S. Garret" wrote: > So I'm following this Django tutorial to become more familiar with how it > works: > > https://docs.djangoproject.com/en/dev/intro/tutorial03/#write-views-t... > > I got to this part: > > Reload the page. Now you'll see an error: > > TemplateDoesNotExist at /polls/ > polls/index.html > > Ah. There's no template yet. > > I never had this happen I just got this displayed in my browser (after I > cleared the cache on top of that): > > You're looking at the results of poll 2. > > What am I doing wrong? The fact that I don't see this gives me the > impression that I messed somewhere up, anyone have an idea where I could > have possibly stumbled? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Am I overlooking something or is this a bug in ModelForm?
On 31 aug, 17:12, Wim Feijen wrote: > Hello, > > I am using a form which (simplified) looks like this: > > class AdvancedSearchForm(forms.ModelForm): > email = forms.CharField(label='Emailadres', required=False) > > class Meta: > model = Address > fields = [ > 'last_name', > 'middle_name', > 'first_name', > 'email', > 'street', > ] > > Because it is a search form, I do not want to validate the e- > mailfield. However, whenever I add 'email' to get the order of the > meta fields right, default email validation is used. > > I am very surprised at that. Why doesn't it honor my specified email > field which is a CharField? It should get precedence, right? > > Am I overlooking something? Or is this a bug? > > For further reading, > see:https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overri... > and:https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changi... I do not think it is a bug. You are using a modelform, so it is normal that model validation takes place. The fact that that field is not validated when you leave it out of the fields list is because otherwise partial forms would not be able to be validated (which was needed for backwards compatibility). It would seem more natural to use a normal form for a search form, and not trigger model validation at all (since the goal of this form is not creating a model instance) If you really want to keep using a modelform here, you could reorder the fields by setting the keyOrder attribute on the fields OrderedDict in the forms __init__. I still think you would be better off switching to a "normal" form here though. K -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
Unable to have a template NOT show up
So I'm following this Django tutorial to become more familiar with how it works: https://docs.djangoproject.com/en/dev/intro/tutorial03/#write-views-that-actually-do-something I got to this part: Reload the page. Now you'll see an error: TemplateDoesNotExist at /polls/ polls/index.html Ah. There's no template yet. I never had this happen I just got this displayed in my browser (after I cleared the cache on top of that): You're looking at the results of poll 2. What am I doing wrong? The fact that I don't see this gives me the impression that I messed somewhere up, anyone have an idea where I could have possibly stumbled? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Password Field Not being encrypted
Ya, I had to use the set_password method. And I used it by creating my own save function in the UserForm class. Thanks for the help. On Aug 31, 10:22 am, lokesh wrote: > hi, > Use set_password method from django contrib auth models in your > custom model. while saving your custom form pass the password to set > password method and save returned encrypted password in your model. > > Lokesh > > On Aug 31, 12:05 am, raj wrote: > > > > > > > > > Hey guys, I'm trying to make a custom registration form for a custom > > UserProfile class. > > I have the following form: > > > class UserForm(ModelForm): > > username = forms.EmailField(label = _("Email"), widget = > > forms.TextInput(attrs ={ 'id':'email'}), required=True) > > first_name = forms.CharField(widget = forms.TextInput(attrs = > > {'id':'fname'}), required=True) > > last_name = forms.CharField(widget = forms.TextInput(attrs = > > {'id':'lname'}), required=True) > > linked_id = forms.CharField(widget = forms.HiddenInput(attrs = > > {'id':'linkedid'})) > > password = forms.CharField(label=_('Password'), > > widget=forms.PasswordInput(render_value = False), required = True) > > password2 = forms.CharField(label=_('Re-Enter your password'), > > widget > > = forms.PasswordInput(render_value = False)) > > email = forms.CharField(widget = forms.HiddenInput(), required = > > False) > > > class Meta: > > model = UserProfile > > fields = ('username', 'first_name', 'last_name', > > 'linked_id', > > 'password', 'email', ) > > > def clean_password2(self): > > password1 = self.cleaned_data.get("password", "") > > password2 = self.cleaned_data['password2'] > > if password1 != password2: > > raise forms.ValidationError(_("The passwords you > > entered did not > > match!")) > > return password2 > > > def clean_email(self): > > email = self.cleaned_data['username'] > > return email > > > The issue that I'm having is that when the password is entered, and > > saved, its not being encrypted. So I can just view a users password in > > my admin panel... > > How do I get the passwords to be encrypted? I had another website and > > it worked then, but when I'm trying it now, it just isn't working. > > Help please. Thank you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
Am I overlooking something or is this a bug in ModelForm?
Hello, I am using a form which (simplified) looks like this: class AdvancedSearchForm(forms.ModelForm): email = forms.CharField(label='Emailadres', required=False) class Meta: model = Address fields = [ 'last_name', 'middle_name', 'first_name', 'email', 'street', ] Because it is a search form, I do not want to validate the e- mailfield. However, whenever I add 'email' to get the order of the meta fields right, default email validation is used. I am very surprised at that. Why doesn't it honor my specified email field which is a CharField? It should get precedence, right? Am I overlooking something? Or is this a bug? For further reading, see: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets and: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-order-of-fields -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: This is nuts why dont I get POST?
Ah all for a missing " Thank you Tom talk about not seeing the woods for the trees! Sheesh Tom Evans-3 wrote: > > On Wed, Aug 31, 2011 at 3:06 PM, MikeKJ wrote: > >> > > Incorrectly formatted tag, browser falls back to default method, which is > GET. > > 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-users@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. > > > -- View this message in context: http://old.nabble.com/This-is-nuts-why-dont-I-get-POST--tp32372381p32372666.html Sent from the django-users mailing list archive at Nabble.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-users@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: This is nuts why dont I get POST?
On Wed, Aug 31, 2011 at 3:06 PM, MikeKJ wrote: > Incorrectly formatted tag, browser falls back to default method, which is GET. 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-users@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: Password Field Not being encrypted
hi, Use set_password method from django contrib auth models in your custom model. while saving your custom form pass the password to set password method and save returned encrypted password in your model. Lokesh On Aug 31, 12:05 am, raj wrote: > Hey guys, I'm trying to make a custom registration form for a custom > UserProfile class. > I have the following form: > > class UserForm(ModelForm): > username = forms.EmailField(label = _("Email"), widget = > forms.TextInput(attrs ={ 'id':'email'}), required=True) > first_name = forms.CharField(widget = forms.TextInput(attrs = > {'id':'fname'}), required=True) > last_name = forms.CharField(widget = forms.TextInput(attrs = > {'id':'lname'}), required=True) > linked_id = forms.CharField(widget = forms.HiddenInput(attrs = > {'id':'linkedid'})) > password = forms.CharField(label=_('Password'), > widget=forms.PasswordInput(render_value = False), required = True) > password2 = forms.CharField(label=_('Re-Enter your password'), widget > = forms.PasswordInput(render_value = False)) > email = forms.CharField(widget = forms.HiddenInput(), required = > False) > > class Meta: > model = UserProfile > fields = ('username', 'first_name', 'last_name', 'linked_id', > 'password', 'email', ) > > def clean_password2(self): > password1 = self.cleaned_data.get("password", "") > password2 = self.cleaned_data['password2'] > if password1 != password2: > raise forms.ValidationError(_("The passwords you > entered did not > match!")) > return password2 > > def clean_email(self): > email = self.cleaned_data['username'] > return email > > The issue that I'm having is that when the password is entered, and > saved, its not being encrypted. So I can just view a users password in > my admin panel... > How do I get the passwords to be encrypted? I had another website and > it worked then, but when I'm trying it now, it just isn't working. > Help please. Thank you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
This is nuts why dont I get POST?
Model from django.db import models # Create your models here. roof_choices = ( ("South", "South"), ("South East", "South East"), ("South West", "South West"), ("East", "East"), ("West", "West"), ("North", "North") ) pv_choices = ( ("0.1-5 kWph", "0.1-5 kWph"), ("1-2 kWph", "1-2 kWph"), ("2-3 kWph", "2-3 kWph"), ("3-4 kWph", "3-4 kWph"), ("4-10 kWph", "4-10 kWph"), (">10kWph", ">10kWph") ) hear_choices = ( ("Leaflet", "Leaflet",), ("Google", "Google"), ("Bing", "Bing"), ("Yahoo", "Yahoo"), ("Other Search Engine", "Other Search Engine"), ("Newspaper", "Newspaper"), ("Yellow Pages", "Yellow Pages"), ("Company Vehicle", "Company Vehicle"), ("Recommendation", "Recommendation"), ("TV", "TV"), ("Radio", "Radio"), ("Existing Customer", "Existing Customer"), ("Telephone Call", "Telephone Call"), ("Other", "Other") ) class Capture(models.Model): title = models.CharField(max_length=10) initial = models.CharField(max_length=5) surname= models.CharField(max_length=30) email = models.EmailField() telephone = models.CharField(max_length=30) add1 = models.CharField(max_length=100) add2 = models.CharField(max_length=100, null=True, blank=True) town_city = models.CharField(max_length=100, null=True, blank=True) county = models.CharField(max_length=100, null=True, blank=True) pcode = models.CharField(max_length=30, null=True, blank=True) roof = models.CharField(choices = roof_choices, max_length=25) pv = models.CharField(choices = pv_choices, max_length=25) heard = models.CharField(choices = hear_choices, max_length=50) def __unicode__(self): return self.email View from django import forms from django.forms import ModelForm from django.shortcuts import render_to_response from django.http import HttpResponse, HttpResponseRedirect from django.forms.util import ValidationError from django.core.mail import send_mail from django.conf import settings from smartpages.models import SmartPage import re from django.template import RequestContext from capture.models import Capture, pv_choices, hear_choices, roof_choices class CaptureForm(ModelForm): title = forms.CharField(required=True, label = "Title") initial = forms.CharField(required=True, label = "Initial") surname = forms.CharField(required=True, label="Surname") email = forms.EmailField(required=True, label="Email Address") telephone = forms.CharField(required=True, label="Telephone") add1 = forms.CharField(required=True, label="Address 1") add2 = forms.CharField(required=False, label="Address 2") town_city = forms.CharField(required=True, label="Town/City") pcode = forms.CharField(required=True, label="Post Code") county = forms.CharField(required=True, label="County") roof = forms.ChoiceField(choices=roof_choices, required=True, label="Roof Orientation") pv = forms.ChoiceField(choices=pv_choices, required=True, label="PV Size") heard = forms.ChoiceField(choices=hear_choices, required=True, label="Heard of Us?") class Meta: model = Capture def capture(request): if request.POST: raise NameError("XXX") form = CaptureForm(request.POST) if form.is_valid(): title = form.cleaned_data['title'] initial = form.cleaned_data['initial'] surname = form.cleaned_data['surname'] email = form.cleaned_data['email'] telephone = form.cleaned_data['telephone'] add1 = form.cleaned_data['add1'] if form.cleaned_data['add2']: add2 = form.cleaned_data['add2'] town_city = form.cleaned_data['town_city'] county = form.cleaned_data['county'] roof = form.cleaned_data['roof'] pv = form.cleaned_data['pv'] heard = form.cleaned_data['heard'] msg_header = "Form content\n\n" msg_middle = "Name: %s %s %s" % (form.cleaned_data['title'], form.cleaned_data['initial'], form.cleaned_data['surname']) msg_middle += "Email: %s\n\n" % form.cleaned_data['email'] msg_middle += "Telephone: %s\n\n" % form.cleaned_data['telephone'] send_mail(settings.EMAIL_SUBJECT_PREFIX + "Email from the capture detail form to use the calculator", msg_header+msg_middle, settings.DEFAULT_FROM_EMAIL, [settings.CONTACT_EMAIL_TO,], fail_silently=False) return HttpResponseRedirect('/cost-and-earnings-calculator/') else: form = CaptureForm(request.POST) else: form = CaptureForm() try: content = SmartPage.objects.get(slug="calculator") except SmartPage.DoesNotExist: content = None return render_to_response("capture/form.html", {"form": form, "content": content, }, context_instance=RequestContext(request)) Template {% extends "base.html" %} {% block extrahead %} {% block me
Re: django-sms-gateway
__init.py__ (incorrect) or __init__.py (correct)? I suspect you'll need to a) describe in more detail what you're trying to do and what's failing, and b) share more of your code and the error traceback in order for anyone to help you diagnose the problem. On Aug 31, 4:28 am, damola oyeniyi wrote: > Hi all, > > I have managed to install django-sms-gateway for use in my application, but I > run into a few problems. > > The structure of the package is such that the 3 models are inside a models > directory. So far, everything looks like its in place; there is an > __init.py__ file in the models directory complete with proper code and each > model file is aptly described with the app_label meta. However, I still > cannot get the code to run. > > The errors I get after tweaking include: > > cannot import name Gateway > no model named model > > What to do? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Argh: templates, admin, and app loading order
Hm, yes, that might work, although at this point I'm a little concerned about changing the order of applications anyway, since I'm not sure what other side effects it might have. Mostly I'm uncomfortable with how important application order ends up being to how one's project operates, especially given that the behavior is inconsistent for different aspects of the framework. Is there any way to force the third party app's admin.register() calls to execute before running my own -- e.g. by importing thirdparty.admin at the top of my admin.py? On Aug 30, 5:51 pm, Doug Ballance wrote: > Can you use the filesystem loader as the first template loader, then > set TEMPLATE_DIRS in settings.py to specify a template directory > outside any app? Use this location for all of your overrides, just > make sure the path is right... ie each app you override would have its > own subdirectory. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 render context like this :
thansk Evans , it worked . =) On Aug 31, 6:48 pm, Tom Evans wrote: > On Wed, Aug 31, 2011 at 11:40 AM, kele wrote: > > > c = Context( {'teams': > > {1: ['a', 'b'] , 2:['c', 'd']} > > } ) > > > i have try like this : > > > {% for k in teams %} > > {{k}} {{k.0}} # also try teams[k] ... etc. but also > > dosent work > > {% endfor %} > > > sorry for my noob question , but pls show me how to to this . > > {% for k,v in teams.items %} > {{ k }}: {{ v.0 }} , {{ v.1 }} > {% endfor %} > > 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-users@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 run tests?
> Try "manage.py test data". Django doesn't really like those > dot-separated namespace packages, sadly. Only the last part is used. Ah, that works. Interesting. I wasn't the one who originally picked the name. I'll look into changing it. Thanks, --Steve -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 Development environment
On 08/31/2011 01:46 PM, graeme wrote: On Aug 31, 1:16 pm, Jani Tiainen wrote: On 08/28/2011 12:31 PM, Simon Connah wrote: On 28 Aug 2011, at 04:41, Sam Walters wrote: Debug client-side: firebug, yslow, a windows computer with ie7 Rather than using a separate computer with IE 7 I tend to just spin up an Amazon EC2 instance running Windows Server 2003 or Windows Server 2008 for a couple of hours. It makes everything so much easier when it comes to testing. Or you can always download "Internet Explorer Application Compatibility VPC Image" [1] images from Microsoft directly. (there are IE6 - IE9 images available) for testing websites. Very useful with VirtualBox. [1]http://www.microsoft.com/download/en/details.aspx?id=11575 I thought it took a bit of work to get those VPC images to work with VirtualBox. The last time I looked they were tied to Virtual PC (virtual) hardware, and had activation issues with VirtualBox. Has that changed? VirtualBox 4.1 in Ubuntu Just downloaded image parts, extracted multipart rar package. Then comes the tricky part: When creating new VM you trick is to attach VHD image as an IDE drive, not SATA (Defautl creation attaches image as SATA). And of course you don't try to activate it but that's enough for testing. -- Jani Tiainen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-sms-gateway
Hi Matt, The file is unchanged! I have just added the 'sms' app into the INSTALLED_APPS section of my settings.py file. I'm trying to loadadmin pages to enter the parameters for my gateway account when I get the error From: Matthew Schinckel To: damola oyeniyi Sent: Wednesday, August 31, 2011 12:03:03 PM Subject: Re: django-sms-gateway I'm guessing that you have a problem in models/gateway.py - perhaps there is a 'model' that should be 'models'. What is the current contents of that file? On 31/08/2011, at 5:58 PM, damola oyeniyi wrote: Hi all, > > >I have managed to install django-sms-gateway for use in my application, but I >run into a few problems. > > >The structure of the package is such that the 3 models are inside a models >directory. So far, everything looks like its in place; there is an __init.py__ >file in the models directory complete with proper code and each model file is >aptly described with the app_label meta. However, I still cannot get the code >to run. > > >The errors I get after tweaking include: > > >cannot import name Gateway >no model named model > > >What to do? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 Development environment
I am only supposed to be developing part time (mostly my own sites, occasionally a client), so my choices may not suit everyone (compromises with other needs, and have to be easy to learn). Linux Mint Debian Edition zsh (better history search reduces typing of various manage.py commands etc.) Komodo Edit with NST (New Source Tree) South debug_toolbar (very useful, especially for spotting mistakes) On Aug 23, 3:07 am, Stephen Jackson wrote: > I am new to the world of Django. I would like to hear from other django > developers describe their dev environment (tools, os, editors, etc.). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 render context like this :
On Wed, Aug 31, 2011 at 11:40 AM, kele wrote: > > > c = Context( {'teams': > {1: ['a', 'b'] , 2:['c', 'd']} > } ) > > i have try like this : > > {% for k in teams %} > {{k}} {{k.0}} # also try teams[k] ... etc. but also > dosent work > {% endfor %} > > sorry for my noob question , but pls show me how to to this . > {% for k,v in teams.items %} {{ k }}: {{ v.0 }} , {{ v.1 }} {% endfor %} 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-users@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 Development environment
On Aug 31, 1:16 pm, Jani Tiainen wrote: > On 08/28/2011 12:31 PM, Simon Connah wrote: > > > > > On 28 Aug 2011, at 04:41, Sam Walters wrote: > > >> Debug client-side: > >> firebug, yslow, a windows computer with ie7 > > > Rather than using a separate computer with IE 7 I tend to just spin up an > > Amazon EC2 instance running Windows Server 2003 or Windows Server 2008 for > > a couple of hours. It makes everything so much easier when it comes to > > testing. > > Or you can always download "Internet Explorer Application Compatibility > VPC Image" [1] images from Microsoft directly. > > (there are IE6 - IE9 images available) for testing websites. Very useful > with VirtualBox. > > [1]http://www.microsoft.com/download/en/details.aspx?id=11575 I thought it took a bit of work to get those VPC images to work with VirtualBox. The last time I looked they were tied to Virtual PC (virtual) hardware, and had activation issues with VirtualBox. Has that changed? > > -- > > Jani Tiainen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 to render context like this :
c = Context( {'teams': {1: ['a', 'b'] , 2:['c', 'd']} } ) i have try like this : {% for k in teams %} {{k}} {{k.0}}# also try teams[k] ... etc. but also dosent work {% endfor %} sorry for my noob question , but pls show me how to to this . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
Security implications of using the form.fields dictionary directly
Hi all, In relation to my previous post (unanswered, http://groups.google.com/group/django-users/browse_thread/thread/aad6fc7e6ad71b4f) I would like to ask about the security implications of doing the following: What I would like to have in the template is: {{ form.tueren.A}} {{ form.tueren.B }}, etc. If I inherit from form.Field and create a tueren FormField with attributes A,B, etc. I have a direct access to it via form.fields['tueren'], so I can write in the template: {{ form.fields.tueren.A}} {{ form.fields.tueren.B }} However, this effectively circumvents the default mechanism of instantiating a BoundField that restricts the use of the Field in certain ways, so I was wondering what kind of security repercussions this might have? Best regards, Venelin Petkov -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-sms-gateway
Hi all, I have managed to install django-sms-gateway for use in my application, but I run into a few problems. The structure of the package is such that the 3 models are inside a models directory. So far, everything looks like its in place; there is an __init.py__ file in the models directory complete with proper code and each model file is aptly described with the app_label meta. However, I still cannot get the code to run. The errors I get after tweaking include: cannot import name Gateway no model named model What to do? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 Development environment
On 08/28/2011 12:31 PM, Simon Connah wrote: On 28 Aug 2011, at 04:41, Sam Walters wrote: Debug client-side: firebug, yslow, a windows computer with ie7 Rather than using a separate computer with IE 7 I tend to just spin up an Amazon EC2 instance running Windows Server 2003 or Windows Server 2008 for a couple of hours. It makes everything so much easier when it comes to testing. Or you can always download "Internet Explorer Application Compatibility VPC Image" [1] images from Microsoft directly. (there are IE6 - IE9 images available) for testing websites. Very useful with VirtualBox. [1] http://www.microsoft.com/download/en/details.aspx?id=11575 -- Jani Tiainen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.