Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
BTW, I reread you're last note. The references to AbstractBaseUser were meant for inheritance, meaning that your custom user would inherit all of the same properties and not need to redefine the wheel. You can't inherit from AbstractUser though because you are modifying the username field. -James

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
"A pallet of authentication systems..." Yep, you work for an educational entity, as do I. :-D You can pursue the LegacyUser model as your custom user model. That would make your LegacyUser objects the 'local' Django users that have been referenced. Not sure about the name though, might indicate

Re: Authentication when usernames are not unique

2015-01-19 Thread Erik Cederstrand
Hi guys, Thanks for a lot of useful answers! My schools use a palette of authentication systems; regular hashed password check with a hash I have access to, LDAP auth and WAYF (a Danish educational SSO solution using Shibboleth). Those are the least of my worries right now, though. I'll have

Re: Authenticate users with both username and email

2015-01-19 Thread Abraham Varricatt
Damn. That's one heck of an explanation James! And very detailed to boot! As a programmer, the OP's approach to login a user with either username/email with ONLY the default auth system seemed flawed (or incomplete, at best) to me. You've not just validated my opinion, but given me a wonder

Any reliable django stripe payments library

2015-01-19 Thread Chen Xu
Hi Everyone, Is there any reliable django stripe payments library that does not require to run a python manage.py syncdb? The reason I am asking is I am uaing SQLAlchemy instead of its builtin ORM. Thanks -- ⚡ Chen Xu ⚡ -- You received this message because you are subscribed to the Google

sending email

2015-01-19 Thread sum abiut
Hi, I am trying to send an email to several users once a form is submit. I have done the view.py to update the database once the form is submitted and is working fine. what i want to accomplish when the form is submitted is to update the database and at the same time send out email when a user

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
Thank you Daniel, I didn't know this! I am going to lookup how to use session. Thanks! On Monday, 19 January 2015 17:13:10 UTC+8, Daniel Roseman wrote: > > On Monday, 19 January 2015 07:28:14 UTC, Cheng Guo wrote: >> >> Hello, >> >> I am new to Django and I have run into an issue with views.py.

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
Hello James: Thank you very much for spending the time reading and answering this question, really appreciated! I complete understand your suggestion of overriding the "save" method in the "UploadFile" to generate the id before saving. Thank you for pointing this out. On the other hand, I

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
Hello James: Thank you very much for spending the time reading and answering this question, really appreciated! I complete understand your suggestion of overriding the "save" method in the "UploadFile" to generate the id before saving. Thank you for pointing this out. On the other hand, I

Re: filter

2015-01-19 Thread sum abiut
Thanks very much for all the help I am getting from you guys. your help is very much appreciated. cheers, On Mon, Jan 19, 2015 at 8:32 PM, Abraham Varricatt < abraham.varric...@googlemail.com> wrote: > In addition to the other answers, I will suggest that you re-think your > view logic - you

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
For a pure authentication scenario where permission checks never go beyond user.is_authenticated(), that's probably true. If all the OP is doing is displaying data, they may be able to get away with manually associating the campus and user within the session after, and displaying data based on

Re: Why do the IDs in many to many join tables change when there is no change.

2015-01-19 Thread jonas hagstedt
First off: this sounds like a bug, please log an issue on Github with as much info as possible (router, serializer and model etc. if you can) I would recommend not using `SelfPublishModel` in this scenario, instead publish the event manually. If you do it manually you lose out on having it

Re: Authentication when usernames are not unique

2015-01-19 Thread Stephen J. Butler
Shibboleth 2.0 lets you setup a discovery service (or portal would perhaps be a better term) letting the user select which ID Provider (IdP) they will authenticate to. All you have to do on the Service Provider (SP) side is specify the discovery URL and what IdPs you allow. Nothing needs to be

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
Hmm, yes, Shibboleth will require some extra trickery in multiple views with redirects to the respective campus portal, etc. I've never done it myself, but I believe the API is pretty well documented. -James On Jan 19, 2015 1:48 PM, "James Schneider" wrote: > That's an

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
That's an interesting (but understandable) requirement, which means you are probably in for an interesting time. Undoubtedly you'll need to roll your own authentication backend ( https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#authentication-backends) and a custom user that

Re: Authentication when usernames are not unique

2015-01-19 Thread Stephen J. Butler
Just as a case study, Shibboleth does this by having unscoped and scoped usernames. The scoped username should be globally unique and takes the form of "u...@school1.edu". Unscopped is not globally unique, but unique for a particular scope (ie: "user"). It's temping to say "ahh... email address!"

Authentication when usernames are not unique

2015-01-19 Thread Erik Cederstrand
Hello I'm creating a Django frontend for a legacy school system. The legacy system has users, but usernames are only unique together with a school: class LegacyUser(models.Model): school = models.ForeignKey(School) username = models.CharField(max_length=40) class Meta:

Re: Lock Django DB on 9 of 10 concurrent uwsgi workers - how to?

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 19.24 skrev Andreas Krueger : > > > > What is the most elegant way to > > lock the Django DB while I make a complex transaction (read, decide, write) > > ... during which no other uwsgi worker should have access (or at least no > write access)

Re: installation of mysqlclient

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 20.28 skrev th.gran...@free.fr: > Thanks but i have a problem! > > when i launch the install command i get these errors > > Downloading mysqlclient-1.3.4.tar.gz (77kB) >100% || 77kB 356kB/s >/bin/sh: 1: mysql_config: not found >

Lock Django DB on 9 of 10 concurrent uwsgi workers - how to?

2015-01-19 Thread Andreas Krueger
What is the most elegant way to lock the Django DB while I make a complex transaction (read, decide, write) ... during which no other uwsgi worker should have access (or at least no write access) to that table? I am using Django + db.sqlite3 + uwsgi (+ nginx). Thanks a lot! Andreas

Re: installation of mysqlclient

2015-01-19 Thread th . granier
On Monday, January 19, 2015 at 7:55:06 PM UTC+1, th.gr...@free.fr wrote: > > Hello > > i am trying to use Dkango with Python3.4.2 and mysql > > i have downloaded mysqlclient-1.3.4 but i don't know how to install it. > it's a .whl file > > Can you help me please? > > Many thanks > > Thanks but i

Re: installation of mysqlclient

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 19.55 skrev th.gran...@free.fr: > > Hello > > i am trying to use Dkango with Python3.4.2 and mysql > > i have downloaded mysqlclient-1.3.4 but i don't know how to install it. it's > a .whl file > > Can you help me please? Just use pip instead. This should get you the

installation of mysqlclient

2015-01-19 Thread th . granier
Hello i am trying to use Dkango with Python3.4.2 and mysql i have downloaded mysqlclient-1.3.4 but i don't know how to install it. it's a .whl file Can you help me please? Many thanks T. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: formset - how to set a from error from formset.clean?

2015-01-19 Thread Richard Brockie
Thank you - that looks like what I am looking for! I don't know how I missed that. I'm on 1.6 right now - another reason to move to 1.7 :) R. On Mon, Jan 19, 2015 at 9:16 AM, Collin Anderson wrote: > Hi, > > You might be able to do something like: > >

Re: post_save signal not working in Django 1.7

2015-01-19 Thread Luis Matoso
Something similar is happening with me too: on a post_save of model it isn't created yet on database, so several error are raised by functions which expect that it is already on DB. When the post_save handler ends, the object is saved normally. On Friday, January 16, 2015 at 4:14:09 PM UTC-2,

Re: need help to configure new domain

2015-01-19 Thread zsandrusha .
Sank's for responding, but we already made all, there was no DB after server crash or something like this. On Sat, Jan 17, 2015 at 4:12 PM, Collin Anderson wrote: > Hi, > > Did you figure it out? It looks like you need to configure your urls.py so > it's connected with

Flood of ''Invalid HTTP_HOST header" mails

2015-01-19 Thread Andreas Pritschet
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi folks, after upgrading my project to Django 1.7 it seems my host validation got a bit out of control. I have tried these possibilities, but my web server continues to send lots of mail about invalid HTTP_HOST headers: ALLOWED_HOSTS = [

Re: Help a newb with authentication and registration

2015-01-19 Thread Collin Anderson
Hi, Here's a nice tutorial: http://musings.tinbrain.net/blog/2014/sep/21/registration-django-easy-way/ Collin On Saturday, January 17, 2015 at 1:20:56 PM UTC-5, Ben Gorman wrote: > > I've spent the past few weeks trying to set up a custom (but not > unreasonable) user registration and

Re: How to make generic variables available in settings and contexts?

2015-01-19 Thread Collin Anderson
Hi All, Also, check out assignment_tags if you haven't seen them. https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#assignment-tags Collin On Sunday, January 18, 2015 at 8:09:58 AM UTC-5, James Schneider wrote: > > If you need it in all of (or a large majority of) your

Re: formset - how to set a from error from formset.clean?

2015-01-19 Thread Collin Anderson
Hi, You might be able to do something like: self.forms[3].add_error('field_name', 'error message') https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.add_error Collin On Saturday, January 17, 2015 at 10:46:27 PM UTC-5, Richard Brockie wrote: > > Hi everyone, > > In a

Re: Uniqueness of "."

2015-01-19 Thread Collin Anderson
Hi, Yes, looking at the code, it appears that there's nothing preventing you from creating clashing custom permissions. Ideally, the unique_together should be on ('content_type__app_name', 'codename') if that's even possible. Collin On Friday, January 16, 2015 at 1:37:02 PM UTC-5, Torsten

Re: post_save signal not working in Django 1.7

2015-01-19 Thread Collin Anderson
Hi, Are you using AUTH_USER_MODEL? I assume your logging is set up correctly? Here's a snippet from one of my projects if you want to try out some similar code: def user_save_handler(sender, **kwargs): user = kwargs['instance'] try: user.userprofile except

Re: SECURE_PROXY_SSL_HEADER requires referer

2015-01-19 Thread Larry Martell
On Sat, Jan 17, 2015 at 10:03 AM, Larry Martell wrote: > We have a django app accessed via SSL (i.e. with https). When we went > to the admin site and it was redirected to admin/login/?next=/admin/ > because we were not logged in, the https was not carried over and the >

Re: Desperately need Django help!

2015-01-19 Thread Vijay Khemlani
For single page applications I highly recommend this tutorial, it answers the typical questions regarding single page apps. https://thinkster.io/brewer/angular-django-tutorial/ (assuming you are using angularJS) On Mon, Jan 19, 2015 at 5:08 AM, wrote: > Hi, I am trying

Re: Windows path for django_crontab

2015-01-19 Thread Michael Manfre
If you don't end up using Celery, another option for a periodic action is to create a management command and schedule it to run with Task Scheduler (http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx). Regards, Michael Manfre On Sunday, January 18, 2015 at

Re: Linking to multiple dynamic images from same web page

2015-01-19 Thread Derek
Thanks Mitesh I thought it might be along those lines. I have tried calling plt.close() just before I return from the plot creation function, but still get the same error. Do you perhaps have a simple code example I can try and follow? (I am already using the io module for the image

Why do the IDs in many to many join tables change when there is no change.

2015-01-19 Thread Shazwi Suwandi
I'm using Swampdragon to provide real time updates to the system since I don't want users to keep refreshing their page to get them. I used the *ModelPublisherRouter* which causes me to get any updates to a particular model. I currently have an Events model with the following attributes: class

Re: having problem with jquery ajax

2015-01-19 Thread James Schneider
Quick guess, you are visiting the site in your browser using http://localhost:8000. I'm betting if you instead visited it using http://127.0.0.1:8000, the AJAX query would work fine. You have http://127.0.0.1:8000 hard coded (or being generated) everywhere. Either change your JavaScript to use

Re: Why this code does not change users firstname and lastname?

2015-01-19 Thread joulumaa
Why would it make sense to switch from different form type? I use below form to get information that I like to save to user database? Part of information I need ot update goes to Additional user info class, I would like to stay in my own form. -Thanks maanantai 19. tammikuuta 2015 11.26.47

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread AJ
*Hi,* *What i understood is that you need two different forms on single page. and later on you want to map feedback form as site specific.* *So you can do with two different ways:* *1) define two different form action path.* * ...form fields... ...form fields...* *2) you have will

Desperately need Django help!

2015-01-19 Thread neil . asnani
Hi, I am trying to build a single page, restful application to track expenses that allows users to sign up, log in, and edit / delete / filter expenses, all on a single page. I am very new to Django, and all other web technologies and this app is making my head spin. I have been working on

having problem with jquery ajax

2015-01-19 Thread Aussie Niki
my view: def aget(request): if request.is_ajax() : json_data={} json_data['messege']= 'sorry' return HttpResponse(json.dumps(json_data), content_type='applicaton/json') my url: urlpatterns = patterns('', url(r'^$', 'post.views.home',

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Tobias Dacoir
I managed to do it! Thanks to your help. Ok all you need to do is this: views.py: class ReportFormView(FormView): form_class = ReportForm template_name = 'contact_form/contact_form.html' def form_valid(self, form): form.save() return super(ReportFormView,

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Vijay Khemlani
OK, I read a little of the library documentation, and this is what you have to do I think 1. subclass the ContactForm (you already have that) 2. subclass the ContactFormView from the library, at least with this: class ReportFormView(ContactFormView): form_class = ReportForm 3. Map this view

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Tobias Dacoir
Thanks for the reply. I was wondering about the if statement about request.type as well, but I took the code from Stackoverflow and a combination of the original source code. It calls a Class.as_view() and I wasn't sure if I need to overwrite that as well. I didn't really want to write all the

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Tobias Dacoir
According to the official documentation I'm still unsure if I need to type anything in my views.py at all. As far as I understand this, I just need to subclass ContactForm somehow: class ContactForm(forms.Form): """ The base contact form class from which all contact form classes should

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Tobias Dacoir
Thanks for the reply. I was wondering about the if statement about request.type as well, but I took the code from Stackoverflow and a combination of the original source code. It calls a Class.as_view() and I wasn't sure if I need to overwrite that as well. I didn't really want to write all the

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Vijay Khemlani
Right now the "reportForm" variable is pointing to the RequestForm class, not to an object, so you need to do it like this reportForm = ReportForm()# Take note of the parenthesis In your template, your form tag need an action attribute (well, it's not mandatory but it is highly advised). In

Re: Authenticate users with both username and email

2015-01-19 Thread James Schneider
I guess I'm not clear on what you are trying to achieve. There are a couple of scenarios to consider. As it stands with the default contrib.auth authentication backend, sending both the username and email address entered by the user will only work IF the user registered/was created using their

How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Tobias Dacoir
I need to include two different contact forms in my app. One a general contact form and another Report / Feedback form that pre-fills some data depending on which site it was called from. So I hit google, found django-contact-form, installed it and after creating some basic templates (and rest

Re: filter

2015-01-19 Thread Abraham Varricatt
In addition to the other answers, I will suggest that you re-think your view logic - you haven't handled the case where your IF block fails. Remember, Django expects every view function to return a HttpResponse object. Assume that someone's request isn't authorized (yet) or even rejected. What

Re: Authenticate users with both username and email

2015-01-19 Thread Abraham Varricatt
Ignoring the malformed code, will the call to authenticate() even work without username? According to the docs, https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.authenticate It takes credentials in the form of keyword arguments, for the default > configuration this

Re: Why this code does not change users firstname and lastname?

2015-01-19 Thread Daniel Roseman
On Monday, 19 January 2015 09:22:02 UTC, joulumaa wrote: > > I have created user earlier in code with email address and password. > Created users work fine. > Now in later phase I asked more information and would like to fill in > first_name and last_name. > Code shows old first_name and

Why this code does not change users firstname and lastname?

2015-01-19 Thread joulumaa
I have created user earlier in code with email address and password. Created users work fine. Now in later phase I asked more information and would like to fill in first_name and last_name. Code shows old first_name and last_name properly if set in admin view, but logged in user cannot save his

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Daniel Roseman
On Monday, 19 January 2015 07:28:14 UTC, Cheng Guo wrote: > > Hello, > > I am new to Django and I have run into an issue with views.py. I > understand that there is a function behind each view. For a view that I am > currently writing, it accepts a file upload from user and stores the file >

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread James Schneider
I wouldn't decorate them as class methods. You would want to call them from the objects themselves. For the save_to_disk() method, I was actually referring to the Django save() method ( https://docs.djangoproject.com/en/1.7/topics/db/models/#overriding-predefined-model-methods ). As you have it

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
So in my case, I need to generate a unique id for the file and save it to disk. I have a model called UploadFile, so you recommend to add two class methods to the UploadFile model, like the following? class UploadFile(models.Model): @classmethod def generate_id(): pass

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread James Schneider
I second moving some (or most) of the functionality to models.py. For instance, calculating the SHA value should be done as part of the model's save() function, not done in the view. Convention dictates that the only code that is placed in the view itself should be logic related to prepping the

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
Great, thanks! On Monday, 19 January 2015 15:46:40 UTC+8, Mike Dewhirst wrote: > > On 19/01/2015 6:28 PM, Cheng Guo wrote: > > Hello, > > > > I am new to Django and I have run into an issue with views.py. I > > understand that there is a function behind each view. For a view that I > > am

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Cheng Guo
Great, thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Daniel França
If the operations are model related, why don't move some of those functions to models.py. On Mon 19 Jan 2015 at 08:46 Mike Dewhirst wrote: > On 19/01/2015 6:28 PM, Cheng Guo wrote: > > Hello, > > > > I am new to Django and I have run into an issue with views.py. I > >