Is it possible to return an HttpResponse in django with text & a json object?
Hi all, I am in a bit of a jiffy and need some guidance. Here is the issue: I am creating a basic Q&A application, where a question pops up for the user, along with a form to submit the answer. Depending on the type of question, the input of the form changes (ie if its a multiple choice, its radio buttons, but if its a word problem, its a text area). I am doing this by extending the ModelForm's __init__ method. So far, so good. The problem occurs when an answer is submitted via jquery ajax. My view function receives and processes the request correctly, but I am unable to figure out how to send back *both *the question object (as json object) and the form object (as html) via HTTPResponse. I would be processing the data sent to the client via jquery. I have posted this on SO, but the suggested answer doesn't make sense to me. Here's the link: http://bit.ly/wGkZdA A part of me feels that there is potentially another cleaner way to do what I am trying to do, but I have yet to come up with a more elegant solution (or any solution for that matter). My views.py code is on the SO link, or you can also find it here: http://dpaste.com/hold/694698/ Thanks in advance for all your help. Best, Harshil -- 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.
Looking for a good Document Management System (DMS) to plug into my Django app
Hi folks, I have been looking around all over to find a high quality DMS to plug into my Django application. I'd like to be able to upload and download .docx or .pdf files, edit the metadata, and also be able to serve the content of the files on the front end. If the plugin allows for preview, that would be great as well. I am currently building a content rich django app and need to be able to do something like this: http://bit.ly/pUyLyC I have come across Mayan, and although it has all the features I need, its a separate app in itself and there is no API for me to connect my app to data sitting on Mayan. Any other insight or points in the right direction would be tremendously helpful. Best, Harshil -- 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.
Need help in renaming template tags
Hey everyone, I am running into an issue where two third party apps easy_thumbnail and sorl_thumbnail are using the custom template tag called thumbnail. Hence, I am actually unable to use the tag at all. I would like to change it so that the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A similar issue has cropped up before over on SO, but it hasn't been resolved. See here: http://bit.ly/sE64Tb I have created a templatetags module within one of my apps, and have tried a simple way to rename a registered tag as such: from django import template from sorl.thumbnail.templatetags import thumbnail register = template.Library() def do_sorl_thumbnail(parser, token): return thumbnail(parser, token) register.tag('sorl_thumbnail', do_sorl_thumbnail) Do I need to write a compile function and a render function for this? Any help on this would be great. Thanks, Harshil -- 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: Need help in renaming template tags
Just bumping this up in case anyone can help. Thanks, Harshil On Mon, Dec 26, 2011 at 7:31 PM, CareerDhaba tech wrote: > Hey everyone, > > I am running into an issue where two third party apps easy_thumbnail and > sorl_thumbnail are using the custom template tag called thumbnail. Hence, I > am actually unable to use the tag at all. I would like to change it so that > the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A > similar issue has cropped up before over on SO, but it hasn't been > resolved. See here: http://bit.ly/sE64Tb > > I have created a templatetags module within one of my apps, and have tried > a simple way to rename a registered tag as such: > > from django import template > from sorl.thumbnail.templatetags import thumbnail > > register = template.Library() > > def do_sorl_thumbnail(parser, token): > return thumbnail(parser, token) > register.tag('sorl_thumbnail', do_sorl_thumbnail) > > Do I need to write a compile function and a render function for this? Any > help on this would be great. > > Thanks, > Harshil > > -- 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: Need help in renaming template tags
Hi Andre, Thanks for looking into this. Have you come across this django app? https://github.com/codysoyland/django-smart-load-tag The app claims to have a fix for this problem, but I had trouble getting it to work (unpacking issue). If you can keep me in the loop regarding the ticket, that would be great. Best, Harshil On Mon, Jan 2, 2012 at 6:27 PM, Andre Terra wrote: > Hello, > > I looked into your problem and realized the current implementation of {% > load %} doesn't allow for homonimous tags. I plan on working toward a patch > to fix this, but this can take a little while. Meanwhile, your best bet > would be to fork one of the two projects and change the tag's name, I > guess. Yes, it's very hacky, and no, don't do it in production. > > I'll try to keep you posted once I've got a ticket in TRAC. > > > Cheers, > AT > > > > On Mon, Jan 2, 2012 at 4:38 AM, CareerDhaba tech wrote: > >> Just bumping this up in case anyone can help. >> >> Thanks, >> Harshil >> >> >> On Mon, Dec 26, 2011 at 7:31 PM, CareerDhaba tech >> wrote: >> >>> Hey everyone, >>> >>> I am running into an issue where two third party apps easy_thumbnail and >>> sorl_thumbnail are using the custom template tag called thumbnail. Hence, I >>> am actually unable to use the tag at all. I would like to change it so that >>> the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A >>> similar issue has cropped up before over on SO, but it hasn't been >>> resolved. See here: http://bit.ly/sE64Tb >>> >>> I have created a templatetags module within one of my apps, and have >>> tried a simple way to rename a registered tag as such: >>> >>> from django import template >>> from sorl.thumbnail.templatetags import thumbnail >>> >>> register = template.Library() >>> >>> def do_sorl_thumbnail(parser, token): >>> return thumbnail(parser, token) >>> register.tag('sorl_thumbnail', do_sorl_thumbnail) >>> >>> Do I need to write a compile function and a render function for this? >>> Any help on this would be great. >>> >>> Thanks, >>> Harshil >>> >>> >> -- >> 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. > -- 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: Need help in renaming template tags
I am using two because django-userena uses easy_thumbnail, but I'd like to use sorl-thumbnail for actual thumbnail use in my app. - Harshil On Mon, Jan 2, 2012 at 8:07 PM, francescortiz wrote: > Why are you using two thumbnail providers? > > On Dec 26 2011, 3:01 pm, CareerDhaba tech > wrote: > > Hey everyone, > > > > I am running into an issue where two third party apps easy_thumbnail and > > sorl_thumbnail are using the custom template tag called thumbnail. > Hence, I > > am actually unable to use the tag at all. I would like to change it so > that > > the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A > > similar issue has cropped up before over on SO, but it hasn't been > > resolved. See here:http://bit.ly/sE64Tb > > > > I have created a templatetags module within one of my apps, and have > tried > > a simple way to rename a registered tag as such: > > > > from django import template > > from sorl.thumbnail.templatetags import thumbnail > > > > register = template.Library() > > > > def do_sorl_thumbnail(parser, token): > > return thumbnail(parser, token) > > register.tag('sorl_thumbnail', do_sorl_thumbnail) > > > > Do I need to write a compile function and a render function for this? Any > > help on this would be great. > > > > Thanks, > > Harshil > > -- > 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: Need help in renaming template tags
Sent the previous email without reading the thread. I tried both {% import %} and {% load %}, but it errors out when trying to access either of the thumbnails in the app, spitting out an unpacking error. I have opened an issue on the github page, but haven't heard from the original developer yet. - Harshil On Mon, Jan 2, 2012 at 6:58 PM, Andre Terra wrote: > I now realize the problem is much more complex than what I though > originally. > > My suggestion to you is to use this nifty third-party tool called > django-smart-load-tag[1]. > > Once you get it up and running, try using {% import %} instead of {% load > %}. > > > Cheers, > AT > > [1] https://github.com/codysoyland/django-smart-load-tag > > > On Mon, Jan 2, 2012 at 10:57 AM, Andre Terra wrote: > >> Hello, >> >> I looked into your problem and realized the current implementation of {% >> load %} doesn't allow for homonimous tags. I plan on working toward a patch >> to fix this, but this can take a little while. Meanwhile, your best bet >> would be to fork one of the two projects and change the tag's name, I >> guess. Yes, it's very hacky, and no, don't do it in production. >> >> I'll try to keep you posted once I've got a ticket in TRAC. >> >> >> Cheers, >> AT >> >> >> >> >> On Mon, Jan 2, 2012 at 4:38 AM, CareerDhaba tech wrote: >> >>> Just bumping this up in case anyone can help. >>> >>> Thanks, >>> Harshil >>> >>> >>> On Mon, Dec 26, 2011 at 7:31 PM, CareerDhaba tech >>> wrote: >>> >>>> Hey everyone, >>>> >>>> I am running into an issue where two third party apps easy_thumbnail >>>> and sorl_thumbnail are using the custom template tag called thumbnail. >>>> Hence, I am actually unable to use the tag at all. I would like to change >>>> it so that the template tag from sorl_thumbnail is renamed as >>>> sorl_thumbnail. A similar issue has cropped up before over on SO, but it >>>> hasn't been resolved. See here: http://bit.ly/sE64Tb >>>> >>>> I have created a templatetags module within one of my apps, and have >>>> tried a simple way to rename a registered tag as such: >>>> >>>> from django import template >>>> from sorl.thumbnail.templatetags import thumbnail >>>> >>>> register = template.Library() >>>> >>>> def do_sorl_thumbnail(parser, token): >>>> return thumbnail(parser, token) >>>> register.tag('sorl_thumbnail', do_sorl_thumbnail) >>>> >>>> Do I need to write a compile function and a render function for this? >>>> Any help on this would be great. >>>> >>>> Thanks, >>>> Harshil >>>> >>>> >>> -- >>> 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. > -- 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: Our new startup site build on Django and GAE is now live!
Cool looking site, but it would be useful to allow people to browse the site a bit before having to register. On Fri, Jun 3, 2011 at 9:45 AM, Gath wrote: > Great stuff!! Thumbs up. > > I like the concept! > > Please share you knowledge on how you did the Django/GAE integration. > > Gath > > On Jun 2, 10:02 am, maverick wrote: > > We build a pretty cool website LOCQL (www.LOCQL.com) purely on Django > > and run on GAE has just went live! > > > > I would say development with Django is purely enjoyable experience, > > however the Google Apps Engine does bring us some headache esp. we are > > a location based service, the geo-location related search is a > > challenge for us. > > > > I would like everyone who use Django to give us a try and feedback are > > warmly welcome! > > -- > 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.
'module' object has no attribute 'Manipulator'
Hey, I am very new to Django just started working around with forms. I have been facing difficulty in getting a user registered. Anyways i was following steps given in James Bennet blog. http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/ I have defined my classes, forms similar to whats given on the blog post. Here is my traceback : --- Environment: Request Method: GET Request URL: http://127.0.0.1:8000/cd/ Django Version: 1.3 Python Version: 2.7.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'registration'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.csrf.CsrfResponseMiddleware') Template error: In template c:\users\pradeep\desktop\cd\templates\index.html, error at line 6 Caught AttributeError while rendering: 'module' object has no attribute 'Manipulator' 1 : 2 : 3 : 4 : 5 : Hey you are on index page 6 : Register 7 : 8 : Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "C:\Users\pradeep\Desktop\cd\views.py" in indexPage 8. return direct_to_template(request, template='index.html') File "C:\Python27\lib\site-packages\django\views\generic\simple.py" in direct_to_template 28. return HttpResponse(t.render(c), mimetype=mimetype) File "C:\Python27\lib\site-packages\django\template\base.py" in render 123. return self._render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in _render 117. return self.nodelist.render(context) File "C:\Python27\lib\site-packages\django\template\base.py" in render 744. bits.append(self.render_node(node, context)) File "C:\Python27\lib\site-packages\django\template\debug.py" in render_node 73. result = node.render(context) File "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render 437. url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse 391. *args, **kwargs))) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse 312. possibilities = self.reverse_dict.getlist(lookup_view) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_reverse_dict 229. self._populate() File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _populate 208. for name in pattern.reverse_dict: File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_reverse_dict 229. self._populate() File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _populate 197. for pattern in reversed(self.url_patterns): File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_url_patterns 279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_urlconf_module 274. self._urlconf_module = import_module(self.urlconf_name) File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module 35. __import__(name) File "C:\Users\pradeep\Desktop\cd\registration\urls.py" in 2. from registration import views File "C:\Users\pradeep\Desktop\cd\registration\views.py" in 10. from registration.forms import UserForm, StateForm, CityForm, RegForm, LoginForm, UserSchoolForm, UserCollegeForm, UserUnivForm, UserCompanyForm File "C:\Users\pradeep\Desktop\cd\registration\forms.py" in 15. class UserForm(forms.Manipulator): Exception Type: TemplateSyntaxError at /cd/ Exception Value: Caught AttributeError while rendering: 'module' object has no attribute 'Manipulator' I tried using django-registration but couldn't figure out how everything works as i couldn't find good documentation or working examples using the same :( . Glad if you people can help me out with this error and also if there is an easy way to use the default auth user table and also creating our own user profile. Regards, Pradeep -- 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 gro
Re: 'module' object has no attribute 'Manipulator'
Thanks Jacob for the reply although u didn't answer giving a reason for the error. Well that's where i started, have gone through the basic docs for forms/models etc. I have worked with many other forms, all kinds of models of data and saving them to database etc. The only problem i am facing is while registering the user for the existing auth tables. Its and old example i know but couldn't find any better ones where registration of the user is completely and given in detail. On Sat, Jun 25, 2011 at 1:51 AM, Jacob Kaplan-Moss wrote: > On Fri, Jun 24, 2011 at 3:00 PM, CareerDhaba tech > wrote: > > I am very new to Django just started working around with forms. I have > been > > facing difficulty in getting a user registered. Anyways i was following > > steps given in James Bennet blog. > > > > http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/ > > This is an incredibly old example, and it's written using Django's old > form system. I suggest you start with the official docs: > > https://docs.djangoproject.com/en/1.3/topics/forms/ > > In general, the official docs are going to be better than most of what > you find randomly online, especially for basic stuff like "how do I > use forms?" Try to get familiar with the official docs and how to move > around and find things in 'em and I think you'll find most of what > you're looking for there. > > Jacob > > -- > 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.
Foreign key dependent model's data not getting saved !
Whats the problem with this code ? *models.py *class userprofile(models.Model): user = models.OneToOneField(User) Firstname = models.CharField(max_length=20) Middlename = models.CharField(max_length=20) Surname = models.CharField(max_length=20) Gender = models.CharField(max_length=1, blank=False, choices=GENDER_CHOICES) Date_of_Birth = models.DateField() Hometown = models.ForeignKey(city) StudentType = models.CharField(max_length=20, blank=False, choices=STUDENT_CHOICES) * forms.py *from django.contrib.auth class RegForm(ModelForm): Date_of_Birth = forms.DateField(widget=SelectDateWidget(years=[y for y in range(1960,2005)])) class Meta: model = userprofile exclude = ('user',) * views.py *from django.contrib.auth.forms import UserCreationForm def register(request): if request.method == 'POST': form = UserCreationForm(request.POST) uprofile = RegForm(request.POST) if form.is_valid() and uprofile.is_valid(): userid = form.save() a = RegForm(request.POST,user = userid) a.save() return direct_to_template('success.html',{}) else: userform = UserCreationForm() RF = RegForm() return render_to_response('register.html',{ 'uf': userform, 'rf': RF, }) return render_to_response('regcheck1.html',{}) * regcheck1.html *{% csrf_token %} {{ rf.as_p }} {{ uf.as_p }} * *The user model is getting saved with username and password but the userprofile isn;t :( -- 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: Foreign key dependent model's data not getting saved !
Hey, Thanks Karen for the reply. I have been trying many things on this form and trying to save both the models data using one form in a single instance. I did try the commit=False method too but it gave an error which i couldnt figure out. Everytime i try doing something new an unknown error/exception pops up that too in some random file and location :(. This is the traceback which i got now after changing code Environment: Request Method: POST Request URL: http://127.0.0.1:8000/cd/registration/register/ Django Version: 1.3 Python Version: 2.7.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'registration'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.csrf.CsrfResponseMiddleware') Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "C:\Users\pradeep\Desktop\cd\registration\views.py" in register 23. return direct_to_template('success.html',{}) File "C:\Python27\lib\site-packages\django\views\generic\simple.py" in direct_to_template 26. c = RequestContext(request, dictionary) File "C:\Python27\lib\site-packages\django\template\context.py" in __init__ 177. self.update(processor(request)) File "C:\Python27\lib\site-packages\django\core\context_processors.py" in debug 53. if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: Exception Type: AttributeError at /cd/registration/register/ Exception Value: 'str' object has no attribute 'META' On Sat, Jun 25, 2011 at 11:04 PM, Karen Tracey wrote: > On Sat, Jun 25, 2011 at 1:00 PM, CareerDhaba tech wrote: > >> The user model is getting saved with username and password but the >> userprofile isn;t :( > > > That is a somewhat misleading description of the problem since the code as > you have posted it would not just fail to save the userprofile it would > raise an exception on the attempt to pass user to RegForm, since RegForm as > you have shown it is not expecting user as a keyword argument. > > The right way to handle saving model forms which have explicitly excluded > necessary data is described here: > https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form > > In this case you would want to save the originally-created RegForm instance > uprofile with comit=False, then set the user attribute to the user returned > by the other form save, then save the user profile instance: > > up = uprofile.save(commit=False) > up.user = userid > up.save() > > Karen > -- > http://tracey.org/kmt/ > > -- > 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.
Issue with saving user information during django_registration
Hey folks, Django newbie here and I need some help. I am using django_registration v0.8 and using the docs here: http://readthedocs.org/docs/django-registration/en/latest/index.html I have successfully installed the app, and I am using the default backend for my registration purposes. I have tested this and I can get the form to show up properly at '/accounts/register' However, one problem is that if I try and break the form input (different password1 and password2 or improper username), no validation errors are being invoked. The issue also, is that the username, email, and password data is not being stored in auth_user, and the activation email isn't being sent. >From the default backend doc, "During registration, a new instance of django.contrib.auth.models.User is created to represent the new account, with the is_active field set to False. An email is then sent to the email address of the account, containing a link the user must click to activate the account; at that point the is_active field is set to True, and the user may log in normally." I believe this new instance of django.contrib.auth.models.User is not being created. I have also included the necessary email settings: EMAIL_USE_TLS = True EMAIL_HOST = "smtp.gmail.com" EMAIL_HOST_USER = "Email" EMAIL_HOST_PASSWORD = "Password" EMAIL_PORT = 587 Any help on getting this straight? I am pretty sure I am missing something simple, but been trying to figure it out without any progress. Any help is greatly appreciated. Thanks, Harshil -- 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: Flatpages do not work
Hi Paul, As described in the error, Django couldn't find the url test/ in the URLconf because its not there. Go to the urls.py of your app and add the appropriate link, and view to the URLconf. Go through this link, it should be helpful - https://docs.djangoproject.com/en/1.3/topics/http/urls/ On Wed, Jul 6, 2011 at 3:32 PM, Paul van der Vlis wrote: > Hallo! > > I am a real beginner in Django, I try to install a new chat application > called HelpIM, you will not know it. > > My problem is that the flatpages do not work. I can create a flatpage in > the admin-interface, but when I go to it, I always see a "page not > found" message from HelpIM: https://testchat4.e-hulp.nl/test/ > Maybe this page needs to go "out of the way". But how? > > In the documentation I cannot find something what's not correct: > https://docs.djangoproject.com/en/dev/ref/contrib/flatpages/ > > I am using the development version of Django (1.4), because HelpIM needs > some new features from it. > > When I turn debug on, I see this: > > Page not found (404) > Request Method: GET > Request URL:https://testchat4.e-hulp.nl/test/ > Using the URLconf defined in helpim.urls, Django tried these URL > patterns, in this order: > ^admin/translate/ > ^$ [name='client_join_chat'] > ^admin/ > ^admin/doc/ > ^admin/threadedcomments/ > ^admin/rooms/join/one2oneroom/$ [name='staff_join_next_available_chat'] > ^admin/rooms/join/one2oneroom/(\d+)/$ [name='staff_join_specific_chat'] > ^jsi18n/$ > The current URL, test/, didn't match any of these. > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a standard > 404 page. > -- > > What I miss here is /var/www/testchat4/templates/flatpages/ , there is > my default.html. And I don't know where to configure "helpim.urls". > > With regards, > Paul van der Vlis. > > -- > Linux systeembeheer Groningen > http://www.vandervlis.nl > > -- > 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: Issue with saving user information during django_registration
Bump - anyone has any insight into this? I am happy to post my code, just not sure where I am going wrong. On Wed, Jul 6, 2011 at 2:35 PM, CareerDhaba tech wrote: > Hey folks, > > Django newbie here and I need some help. I am using django_registration > v0.8 and using the docs here: > http://readthedocs.org/docs/django-registration/en/latest/index.html > > I have successfully installed the app, and I am using the default backend > for my registration purposes. > > I have tested this and I can get the form to show up properly at > '/accounts/register' > > However, one problem is that if I try and break the form input (different > password1 and password2 or improper username), no validation errors are > being invoked. > > The issue also, is that the username, email, and password data is not being > stored in auth_user, and the activation email isn't being sent. > > From the default backend doc, "During registration, a new instance of > django.contrib.auth.models.User is created to represent the new account, > with the is_active field set to False. An email is then sent to the email > address of the account, containing a link the user must click to activate > the account; at that point the is_active field is set to True, and the > user may log in normally." > > I believe this new instance of django.contrib.auth.models.User is not being > created. > > I have also included the necessary email settings: > EMAIL_USE_TLS = True > EMAIL_HOST = "smtp.gmail.com" > EMAIL_HOST_USER = "Email" > EMAIL_HOST_PASSWORD = "Password" > EMAIL_PORT = 587 > > Any help on getting this straight? I am pretty sure I am missing something > simple, but been trying to figure it out without any progress. Any help is > greatly appreciated. > > Thanks, > Harshil > > -- 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: Issue with saving user information during django_registration
Bumping once more. Can anyone shine some light on this issue? Would be extremely helpful. On Wed, Jul 6, 2011 at 6:24 PM, CareerDhaba tech wrote: > Bump - anyone has any insight into this? > > I am happy to post my code, just not sure where I am going wrong. > > On Wed, Jul 6, 2011 at 2:35 PM, CareerDhaba tech wrote: > >> Hey folks, >> >> Django newbie here and I need some help. I am using django_registration >> v0.8 and using the docs here: >> http://readthedocs.org/docs/django-registration/en/latest/index.html >> >> I have successfully installed the app, and I am using the default backend >> for my registration purposes. >> >> I have tested this and I can get the form to show up properly at >> '/accounts/register' >> >> However, one problem is that if I try and break the form input (different >> password1 and password2 or improper username), no validation errors are >> being invoked. >> >> The issue also, is that the username, email, and password data is not >> being stored in auth_user, and the activation email isn't being sent. >> >> From the default backend doc, "During registration, a new instance of >> django.contrib.auth.models.User is created to represent the new account, >> with the is_active field set to False. An email is then sent to the email >> address of the account, containing a link the user must click to activate >> the account; at that point the is_active field is set to True, and the >> user may log in normally." >> >> I believe this new instance of django.contrib.auth.models.User is not >> being created. >> >> I have also included the necessary email settings: >> EMAIL_USE_TLS = True >> EMAIL_HOST = "smtp.gmail.com" >> EMAIL_HOST_USER = "Email" >> EMAIL_HOST_PASSWORD = "Password" >> EMAIL_PORT = 587 >> >> Any help on getting this straight? I am pretty sure I am missing something >> simple, but been trying to figure it out without any progress. Any help is >> greatly appreciated. >> >> Thanks, >> Harshil >> >> > -- 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: Issue with saving user information during django_registration
Hi André, Thanks for the feedback. Here is the relevant code: registration_form view: http://dpaste.com/564165/ my views.py file directly from the django_registration app code: http://dpaste.com/564166/ Here is my form class: http://dpaste.com/564167/ - Harshil On Thu, Jul 7, 2011 at 3:52 AM, Andre Terra wrote: > Start by pasting relevant code. Views, forms and possibly the backend > logic. Use dpaste.com > > And quit bumping or you'll never get an answer, not from most of us. > > Regards, > André Terra > > On 7/6/11, CareerDhaba tech wrote: > > Bumping once more. Can anyone shine some light on this issue? Would be > > extremely helpful. > > > > > > On Wed, Jul 6, 2011 at 6:24 PM, CareerDhaba tech > > wrote: > > > >> Bump - anyone has any insight into this? > >> > >> I am happy to post my code, just not sure where I am going wrong. > >> > >> On Wed, Jul 6, 2011 at 2:35 PM, CareerDhaba tech > >> wrote: > >> > >>> Hey folks, > >>> > >>> Django newbie here and I need some help. I am using django_registration > >>> v0.8 and using the docs here: > >>> http://readthedocs.org/docs/django-registration/en/latest/index.html > >>> > >>> I have successfully installed the app, and I am using the default > backend > >>> for my registration purposes. > >>> > >>> I have tested this and I can get the form to show up properly at > >>> '/accounts/register' > >>> > >>> However, one problem is that if I try and break the form input > (different > >>> password1 and password2 or improper username), no validation errors are > >>> being invoked. > >>> > >>> The issue also, is that the username, email, and password data is not > >>> being stored in auth_user, and the activation email isn't being sent. > >>> > >>> From the default backend doc, "During registration, a new instance of > >>> django.contrib.auth.models.User is created to represent the new > account, > >>> with the is_active field set to False. An email is then sent to the > email > >>> address of the account, containing a link the user must click to > activate > >>> the account; at that point the is_active field is set to True, and the > >>> user may log in normally." > >>> > >>> I believe this new instance of django.contrib.auth.models.User is not > >>> being created. > >>> > >>> I have also included the necessary email settings: > >>> EMAIL_USE_TLS = True > >>> EMAIL_HOST = "smtp.gmail.com" > >>> EMAIL_HOST_USER = "Email" > >>> EMAIL_HOST_PASSWORD = "Password" > >>> EMAIL_PORT = 587 > >>> > >>> Any help on getting this straight? I am pretty sure I am missing > >>> something > >>> simple, but been trying to figure it out without any progress. Any help > >>> is > >>> greatly appreciated. > >>> > >>> Thanks, > >>> Harshil > >>> > >>> > >> > > > > -- > > 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. > > > > > > -- > Sent from my mobile device > > -- > 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: How to use the django-users mailing list properly and doing your homework..
Stack Overflow: http://stackoverflow.com On Thu, Jul 7, 2011 at 9:00 AM, Kenneth Gonsalves wrote: > On Thu, 2011-07-07 at 00:10 +0100, Cal Leeming [Simplicity Media Ltd] > wrote: > > I'm going to ask a really stupid question... > > > > What's "SO"? > > I was just going to ask that. > -- > regards > KG > http://lawgon.livejournal.com > Coimbatore LUG rox > http://ilugcbe.techstud.org/ > > -- > 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: Issue with saving user information during django_registration
Yep, that solved the problem. Very stupid mistake on my part, but this is a mistake I will learn from. I am a newbie at HTML as well, and I thought the action was the redirect page, not the page to submit form data. Thanks for your help André. On Thu, Jul 7, 2011 at 6:27 PM, Andre Terra wrote: > I'm mostly guessing, but try this for your registration_form.html template > instead http://dpaste.com/hold/564305/ > > > Cheers, > André > > On Thu, Jul 7, 2011 at 12:03 AM, CareerDhaba tech wrote: > >> Hi André, >> >> Thanks for the feedback. >> >> Here is the relevant code: >> >> registration_form view: >> >> http://dpaste.com/564165/ >> >> my views.py file directly from the django_registration app code: >> >> http://dpaste.com/564166/ >> >> Here is my form class: >> >> http://dpaste.com/564167/ >> >> - Harshil >> >> >> On Thu, Jul 7, 2011 at 3:52 AM, Andre Terra wrote: >> >>> Start by pasting relevant code. Views, forms and possibly the backend >>> logic. Use dpaste.com >>> >>> And quit bumping or you'll never get an answer, not from most of us. >>> >>> Regards, >>> André Terra >>> >>> On 7/6/11, CareerDhaba tech wrote: >>> > Bumping once more. Can anyone shine some light on this issue? Would be >>> > extremely helpful. >>> > >>> > >>> > On Wed, Jul 6, 2011 at 6:24 PM, CareerDhaba tech >>> > wrote: >>> > >>> >> Bump - anyone has any insight into this? >>> >> >>> >> I am happy to post my code, just not sure where I am going wrong. >>> >> >>> >> On Wed, Jul 6, 2011 at 2:35 PM, CareerDhaba tech >>> >> wrote: >>> >> >>> >>> Hey folks, >>> >>> >>> >>> Django newbie here and I need some help. I am using >>> django_registration >>> >>> v0.8 and using the docs here: >>> >>> http://readthedocs.org/docs/django-registration/en/latest/index.html >>> >>> >>> >>> I have successfully installed the app, and I am using the default >>> backend >>> >>> for my registration purposes. >>> >>> >>> >>> I have tested this and I can get the form to show up properly at >>> >>> '/accounts/register' >>> >>> >>> >>> However, one problem is that if I try and break the form input >>> (different >>> >>> password1 and password2 or improper username), no validation errors >>> are >>> >>> being invoked. >>> >>> >>> >>> The issue also, is that the username, email, and password data is not >>> >>> being stored in auth_user, and the activation email isn't being sent. >>> >>> >>> >>> From the default backend doc, "During registration, a new instance of >>> >>> django.contrib.auth.models.User is created to represent the new >>> account, >>> >>> with the is_active field set to False. An email is then sent to the >>> email >>> >>> address of the account, containing a link the user must click to >>> activate >>> >>> the account; at that point the is_active field is set to True, and >>> the >>> >>> user may log in normally." >>> >>> >>> >>> I believe this new instance of django.contrib.auth.models.User is not >>> >>> being created. >>> >>> >>> >>> I have also included the necessary email settings: >>> >>> EMAIL_USE_TLS = True >>> >>> EMAIL_HOST = "smtp.gmail.com" >>> >>> EMAIL_HOST_USER = "Email" >>> >>> EMAIL_HOST_PASSWORD = "Password" >>> >>> EMAIL_PORT = 587 >>> >>> >>> >>> Any help on getting this straight? I am pretty sure I am missing >>> >>> something >>> >>> simple, but been trying to figure it out without any progress. Any >>> help >>> >>> is >>> >>> greatly appreciated. >>> >>> >>> >>> Thanks, >>> >>> Harshil >>> >>> >>> >>> >>> >> >>> > >>> > -- >>> > You received this message because you are subscribed to
Re: RegistrationForm subclass not showing up
Hi Kat, You have to tell the your registration view to use the RegistrationFormTermsofService. First, import that class from forms and change your form_call from None to to RegistrationFormTermsofService. Hope this helps. On Thu, Jul 7, 2011 at 5:34 PM, katstevens wrote: > Hi - I'm new to Django and am using django-registration to set up new > users. > > The basic RegistrationForm shows up fine in my template (which just > uses {{ form.as_table }} to generate fields inside the form HTML), but > I now want to use the RegistrationFormTermsOfService subclass instead. > > I set it as a parameter in urls.py as follows: > url(r'^register/$', > register, > {'form_class': > RegistrationFormTermsOfService}, > name='registration_register'), > > ... but the original RegistrationForm is still showing instead. Any > ideas why this would be? Do I have to remove the default 'form_class' > value in the register declaration in views.py (as that still gives > RegistrationForm as the default)? Or do I need to alter my template? > > I'm sure I'm missing something really obvious - any help gratefully > received. > > Kat > > -- > 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: RegistrationForm subclass not showing up
I believe you are using an older version of django_registration, since there is no reference to the backend in your code. The backend is an addition in the latest (0.8) version of django_registration. Did you download the code from here? http://readthedocs.org/docs/django-registration/en/latest/index.html On Fri, Jul 8, 2011 at 3:39 PM, katstevens wrote: > Thanks for your answer, but unfortunately that hasn't helped - on > further investigation I think the problem is somewhere else, as the > original RegistrationForm class instance (in registration.forms) > doesn't seem to be being called correctly by registration.views (so no > wonder RegistrationFormTermsOfService isn't working!). I tried making > some small changes to the labels in the RegistrationForm class and it > is still displaying the default label values in my template. For > example, the class declaration now looks like: > > class RegistrationForm(forms.Form): > # all the other fields > # ... > password1 = > forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, > render_value=False), >label=_(u'different password label')) > > In registration.views I've imported the form as follows > > from registration.forms import RegistrationForm > > And used the default view declaration: > > def register(request, success_url=None, > form_class=RegistrationForm, profile_callback=None, > template_name='registration/registration_form.html', > extra_context=None): >if request.method == 'POST': > # do post stuff >else: > # instantiate blank form >form = form_class() > > Finally, on the registration_form.html template I've tried calling the > fields explicitly rather than using the form.as_table tag: > > {{ form.password1.label_tag }} > {{ form.password1 }} > > The page displays these fields fine, yet the label still gives the > default label value of 'password' instead of 'different password > label'. I'm not getting any syntax errors, and I've rebooted my server > for good measure with the same results. Therefore I assume that either > form = form_class() isn't actually instantiating RegistrationForm > properly in the view, or there is some sort of overriding default > being called from a different location (maybe django.contrib.auth?). > > Also - I can't see the form_call field that you mention - does this > refer to the parameter 'form_class=RegistrationForm' I've used above > in my registration view? > > Thanks again! > > On Jul 8, 7:08 am, CareerDhaba tech wrote: > > Hi Kat, > > > > You have to tell the your registration view to use the > > RegistrationFormTermsofService. First, import that class from forms and > > change your form_call from None to to RegistrationFormTermsofService. > > > > Hope this helps. > > > > > > > > > > > > > > > > On Thu, Jul 7, 2011 at 5:34 PM, katstevens > wrote: > > > Hi - I'm new to Django and am using django-registration to set up new > > > users. > > > > > The basic RegistrationForm shows up fine in my template (which just > > > uses {{ form.as_table }} to generate fields inside the form HTML), but > > > I now want to use the RegistrationFormTermsOfService subclass instead. > > > > > I set it as a parameter in urls.py as follows: > > > url(r'^register/$', > > > register, > > > {'form_class': > > > RegistrationFormTermsOfService}, > > > name='registration_register'), > > > > > ... but the original RegistrationForm is still showing instead. Any > > > ideas why this would be? Do I have to remove the default 'form_class' > > > value in the register declaration in views.py (as that still gives > > > RegistrationForm as the default)? Or do I need to alter my template? > > > > > I'm sure I'm missing something really obvious - any help gratefully > > > received. > > > > > Kat > > > > > -- > > > 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 t