using celery with django.

2015-01-30 Thread sarfaraz ahmed
I am experimenting with celery with django and i am using windows 7 os on my machine. Here is outcome... so far. I added sample app to my project and added tasks.py to my app. tasks.py

admin site questions

2015-01-30 Thread Mike
I'm building a simple CRUD application to hold some data for our research group. After 2 hours I have the basic functionality working using the admin site only and no custom views. I just need to figure out if I can go ahead and deploy it using the admin site as the main user interface. So,

Re: How to get hold of a session after getting signaled?

2015-01-30 Thread Vijay Khemlani
As far as I can tell on the project source, the only place the "badge_awarded" signal is triggered is in the "award_to" method in the Badge class, which does not handle a request object. If you are calling something like "badge.award_to(user)" in one of your views, then you can modify the request

Re: Best Practices Django Questions

2015-01-30 Thread Babatunde Akinyanmi
On 30 Jan 2015 21:03, "G Z" wrote: > > Hello, I'm in the design stages of a site that I'm building. It is going to be a basic social media site for a game I'm designing in unity. I'm not entirely sure how to do some of the things I want to in Django. Thus, my first question is

Re: Do Signals block Django process?

2015-01-30 Thread Babatunde Akinyanmi
On 30 Jan 2015 17:13, "Tobias Dacoir" wrote: > > I just added django-badges to my project. Basically it can award Badges if Users fullfill certain requirements. For this, everytime I call user.save() django-badges receives the post_save() signal and starts checking. > > Now my

Re: CSRF verification failed when I use smart phone

2015-01-30 Thread Zach Borboa
Here's an example of the csrf cookie value obtained by typing document.cookie in the javascript console. -- You received this message because you are

Re: CSRF verification failed when I use smart phone

2015-01-30 Thread Zach Borboa
What you want to compare is the expected token value and the token value the view received (via POST, PUT, DELETE, etc.). These values need to match. Printing out the token via {{ csrf_token }} in the template will show you the token that the view will receive when the form is submitted. This

Re: using Django on an existing mysql schema

2015-01-30 Thread Russell Keith-Magee
On Fri, Jan 30, 2015 at 10:47 PM, William Muriithi < william.murii...@gmail.com> wrote: > ‎Hello, > > I am new to Django and planning to use it for a project I have in mind. I > am strong in mysql, but not too good in developing. In fact, the secondary > purpose of this project is to improve my

Re: using Django on an existing mysql schema

2015-01-30 Thread Russell Keith-Magee
On Sat, Jan 31, 2015 at 3:14 AM, Tobias Dacoir wrote: > I'm certainly no Django expert, but I'm not sure if you can use the orm > and an already existing database. > Yes, you absolutely can. There's even a management command (inspectdb) to help write the wrapper models, and a

Re: CSRF verification failed when I use smart phone

2015-01-30 Thread Pouria M
Thanks Zach. What are your thoughts after this test? if they match or if they don't match On Wednesday, January 28, 2015 at 9:46:23 PM UTC-8, Zach Borboa wrote: > > For anyone trying to debug this issue, you may want to print out the > variable using {{ csrf_token }} as well as using {%

Re: Best Practices Model Design

2015-01-30 Thread Tobias Dacoir
Hi, I'm quite new to Django myself. I doubt anyone is going through your whole Models File. You should have at least copy & pasted it from some kind of IDE to preserve the indention level. As for your other questions about the url to user-/profilename, have you looked at the tutorial:

Re: Django web hosts in Canada

2015-01-30 Thread jogaserbia
Hi All, Thanks for the ideas. I'll consider the suggestions. Ivan -- 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.

Re: Changing many-to-many using Admin Site never calls post_remove Signal

2015-01-30 Thread Tobias Dacoir
not very nice, and probably not pythonic (still learning) but now I added another two for loops to find old references and delete them: if action == "post_add": if isinstance(instance, Database): # then update pairs for a in instance.audioData():

Changing many-to-many using Admin Site never calls post_remove Signal

2015-01-30 Thread Tobias Dacoir
I have a many-to-many relationship which the Admin can change using the Admin Site. I use a ModelAdmin.filter_horizontal, but even with the default widget it's the same. I registered a receiver when m2m_changed, however it always only calls: pre_clear, post_clear, pre_add, post_add, in that

Best Practices Model Design

2015-01-30 Thread G Z
Hello, I'm in the design stages of a site that I'm building. It is going to be a basic social media site for a game I'm designing in unity. I'm not entirely sure how to do some of the things I want to in Django. Thus, my first question is generally best practices question as well as a how do

Re: Best Practices Django Questions

2015-01-30 Thread G Z
class User(models.Model): id = models.AutoField(primary_key=True) username = models.CharField(max_length=4000) password = models.CharField(max_length=4000) email = models.CharField(max_length=4000) phone = models.CharField(max_length=4000) profile_image = models.FileField()

Re: Best Practices Django Questions

2015-01-30 Thread G Z
class *User*(models.Model): id = models.*AutoField*(primary_key=True) username = models.CharField(max_length=4000) password = models.CharField(max_length=4000) email = models.CharField(max_length=4000) phone = models.CharField(max_length=4000) profile_image = models.FileField() about =

Best Practices Django Questions

2015-01-30 Thread G Z
Hello, I'm in the design stages of a site that I'm building. It is going to be a basic social media site for a game I'm designing in unity. I'm not entirely sure how to do some of the things I want to in Django. Thus, my first question is generally best practices question as well as a how do I

Re: Django web hosts in Canada

2015-01-30 Thread Carlos Carcamo
Why don't you try Digitalocean? Take a look at those articles: https://www.digitalocean.com/community/tutorials/how-to-use-the-django-one-click-install-image https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn If you want $10

Re: using Django on an existing mysql schema

2015-01-30 Thread Tobias Dacoir
I'm certainly no Django expert, but I'm not sure if you can use the orm and an already existing database. However the documentation states that you can write all queries yourself, essentially not using the orm. However if you do that, I'm wondering why you want to use Django at all? And pushing

Re: Do Signals block Django process?

2015-01-30 Thread Tobias Dacoir
Thanks for always answering my questions :) I did read the documentation on uWSGI and I think I have an understanding now of workers and threads (from Webserver or uWSGI) and how it handles multiple users. For the signals and badge calculation, I did see celery pop up a couple of times and I

Re: Do Signals block Django process?

2015-01-30 Thread Vijay Khemlani
The number of threads is determined by the number of workers in your process that is serving the application, not Django itself. For example, if you are using uWSGI to serve the application, then you have a parameter "workers" in its initialization file that sets the number of process to spawn

How to get hold of a session after getting signaled?

2015-01-30 Thread Tobias Dacoir
I'm using django-badges in my project which can emit a signal when a user is awarded a badge. I was able to implemented a receiver function, however the output is the following: signals.py (from badges): import django.dispatch badge_awarded = django.dispatch.Signal(providing_args=['user',

Do Signals block Django process?

2015-01-30 Thread Tobias Dacoir
I just added django-badges to my project. Basically it can award Badges if Users fullfill certain requirements. For this, everytime I call user.save() django-badges receives the post_save() signal and starts checking. Now my project is similar to an online quiz, where users submit forms to

Re: How to detect (daily) User Login when using cookies?

2015-01-30 Thread Tobias Dacoir
Thanks. Though I do not use a Custom Authentication Backend, it should be possible to inherit from the Default one and just overwrite the get_user Method. I will test it out. On Friday, January 30, 2015 at 3:56:10 PM UTC+1, Tom Evans wrote: > > On Fri, Jan 30, 2015 at 1:50 PM, Collin Anderson

using Django on an existing mysql schema

2015-01-30 Thread William Muriithi
‎Hello, I am new to Django and planning to use it for a project I have in mind. I am strong in mysql, but not too good in developing. In fact, the secondary purpose of this project is to improve my python development skills. With such a background, I went about doing my data modeling and then

Re: How to detect (daily) User Login when using cookies?

2015-01-30 Thread Tom Evans
On Fri, Jan 30, 2015 at 1:50 PM, Collin Anderson wrote: > Hi, > > If you use a custom authentication backend, you could update it every time > get_user(request) is called. > HTTP is stateless, authentication happens every request, so that gets called on every request,

Re: Reduce start up time for manage.py

2015-01-30 Thread Daniel Roseman
On Friday, 30 January 2015 14:01:17 UTC, Avraham Serour wrote: > > I believe putting imports inside functions would slow down execution, it > will make the import everytime the function is executed > > one could make something like a lazy import, but you would be trading slow > startup for slow

Custom model field and custom widget

2015-01-30 Thread Thomas Weholt
Hi, I need to create a custom django model field, a varchar(10) field which has a calculated value set on save on the model using it and then never changed. This should happen automatically. This field should appear as hidden or read-only in forms and it would be nice to handle the render

Re: Create Django token-based Authentication

2015-01-30 Thread François Schiettecatte
I wonder if OAuth would help you, see http://oauth.net François > On Jan 30, 2015, at 8:22 AM, Collin Anderson wrote: > > Hi, > > What happens when you try? :) > > Your setup is pretty complicated, but I don't know if REST framework will > help much. > > Collin > >

Re: Reduce start up time for manage.py

2015-01-30 Thread Avraham Serour
I believe putting imports inside functions would slow down execution, it will make the import everytime the function is executed one could make something like a lazy import, but you would be trading slow startup for slow requests On Fri, Jan 30, 2015 at 3:49 PM, Collin Anderson

Middleware + Transactions

2015-01-30 Thread Thomas Güttler
Dear Django developers, we currently have the following issue when upgrading from Django 1.5 to Django 1.6: https://github.com/etianen/django-reversion/issues/268 As it seems, since Django 1.6, middlewares are not supposed to be executed within the same transaction as the view function is.

Re: Putting picture thumbnails within admin page

2015-01-30 Thread Nelson Varela
Make sure you are serving the media fles usins django's static server from django.conf import settings urlpatterns += patterns('', url(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': False}), ) On Tuesday, January 27, 2015 at 1:31:54

Re: How to detect (daily) User Login when using cookies?

2015-01-30 Thread Collin Anderson
Hi, If you use a custom authentication backend, you could update it every time get_user(request) is called. Collin On Wednesday, January 28, 2015 at 4:58:30 AM UTC-5, Tobias Dacoir wrote: > > Yes that would be enough. I know in the User Model there is last_login but > that is only updated

Re: Reduce start up time for manage.py

2015-01-30 Thread Collin Anderson
Hi, Many people would recommend against this, but if you can put the imports for your heavy 3rd party libraries inside functions and methods, that allow them to be loaded only if needed. I would also recommend in general to simply have fewer libraries and apps (easier said than done :) Also,

Re: Best practice to render the view based on the user

2015-01-30 Thread Collin Anderson
Hi, Not sure about whether it's a good idea or not. If statements might also be good enough. Be careful with security, but in theory something like this should work: method_name = 'person' + person.type method = getattr(self, method_name) output = method() Collin On Wednesday, January 28,

Re: Create Django token-based Authentication

2015-01-30 Thread Guilherme Leal
Django REST Framework already implements token authentication (check this out). The rest of the logic is preaty much implementation by the "client" site. But if you do

Re: django / tastypie - how to exclude a resource attribute from obj_create, but keep it for listing

2015-01-30 Thread Collin Anderson
Hi Eugene, Would it work to something like this in your obj_create? bundle.data.pop('blueprint', None) Collin On Tuesday, January 27, 2015 at 11:01:56 AM UTC-5, Eugene Goldberg wrote: > > I have the following tastypie resource: > > class WorkloadResource(ModelResource): > # blueprints =

Re: path to django from jython

2015-01-30 Thread Collin Anderson
Hi, I think you to make sure django is on your PYTHONPATH / sys.path Collin On Tuesday, January 27, 2015 at 10:51:13 AM UTC-5, Josh Stratton wrote: > > Okay, stupid question, but how do I source django when jusing jython? I > have django installed using pip and jython installed locally. I've

Re: Create Django token-based Authentication

2015-01-30 Thread Collin Anderson
Hi, What happens when you try? :) Your setup is pretty complicated, but I don't know if REST framework will help much. Collin On Tuesday, January 27, 2015 at 12:00:59 AM UTC-5, Hossein Rashnoo wrote: > > I have my authentication service on django. I want to role as web-service > to gave

Re: Namespace url lookup inside template of an app

2015-01-30 Thread Thorsten Sanders
Answering my own question, for the case someone else need it: I am used to use render_to_response it not working with it, with using render it works with applying current_app, like this: return render(request, 'myaddons/index.html',

Re: When do I have to call save() on a Model Instance?

2015-01-30 Thread Erik Cederstrand
> Den 29/01/2015 kl. 19.40 skrev Tobias Dacoir : > > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as I > keep the object and a pointer to it in memory I can freely modify it in > several Functions before