Speeding up test database creation

2012-11-26 Thread Andres Reyes Monge
The tutorial uses a sqlite file database not a in memory database, try omitting the name parameter and it should speed things up -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com

Re: FactoryBoy & ManyToManyField

2012-11-20 Thread Andres Reyes Monge
The simplest would be to class ATestCase(TestCase): def setUp(self): super(ATestCase, self).setUp() self.user = UserFactory() self.workplace = WorkplaceFactory() self.workplace.employees_set.add(self.user) def test_foobar(self): # how do I add sel

Re: Installation script?

2012-09-03 Thread Andres Reyes Monge
Take a look at this project https://github.com/dcramer/logan On Monday, September 3, 2012 6:39:41 AM UTC-6, Carsten Agger wrote: > > I've created a Django web service consisting of two separate sites, by > default running on the same server, which implements a "document broker" > service capabl

Re: Problems getting started

2012-03-07 Thread Andres Reyes
For me, the main reason to use virtualenv has nothing to do with security or anything like that, is the convenience of having different projects with different sets of requirements not interfering with each other 2012/3/7 backdoc : > I've never set up virtualenv, so I can't speak to that.  But, ho

Re: "model_name" object has no attribute '_adding'

2012-02-28 Thread Andres Reyes
I'm curious as to where is this in the documentation. I think this is a private attribute so it shouldn't be depended upon 2012/2/28 akaariai : > On Feb 28, 6:30 am, dizzydoc wrote: >> Hi django users, >> >> I have just migrated my projected from django 1.2.7 to django 1.3. >> >> I am receiving t

Re: "model_name" object has no attribute '_adding'

2012-02-28 Thread Andres Reyes
I don't remember reading anything about an "_adding" attribute in the documentation. However, if you want to check for an INSERT vs an UPDATE just check for the existence of a primary key def clean( self ): from django.core.exceptions import ValidationError if self.pk is None: (do th

Re: Access denied - hostname is percent character ('%')?

2012-02-17 Thread Andres Reyes
Saying that the database doesn't exists would be giving to much information to potential atackers triying to connect 2012/2/17 Ishmael : > Thanks for the reply.  The solution to the problem was excruciatingly > simple.  I accidentally capitalized the name of the database, when the > actual name

Re: Dynamic runtime modeling: which is the best choice?

2012-01-31 Thread Andres Reyes
Are you sure you need a new model for every shape your user inserts? Most likely you need to design a generic models in which you would insert new rows for every shape. I mean generic in the sense that it is designed to contain different shapes not any special Django or Python stuff 2012/1/31 Ale

Re: Django Admin completely empty

2012-01-30 Thread Andres Reyes
Do you have permissions on the models you want to see? You can create a new superuser with python manage.py createsuperuser 2012/1/30 darwin_tech : > Hi, > > On my development server my Django Admin works as expected, showing > all my > models and the auth models. However, on the production ser

Re: Adding first_name and last_name to django registration

2012-01-28 Thread Andres Reyes
The django.contrib.auth User model already contains first_name and last_name fields so you don't need a UserProfile for that. Also the view that handles the registration takes a form_class that parameter that you can pass in the urlconf, you would only need to subclass the RegistrationForm, add yo

Re: Need help with userena - assign user to group at signup

2012-01-20 Thread Andres Reyes
What do you mean with the employee choosing the employer option? You normally don't give a choice in the frontend, you just make your choice in the backend depending what your database says 2012/1/19 Jesramz : > > > The problem with that, if I'm understanding correctly, is that a > person who is m

Re: Need help with userena - assign user to group at signup

2012-01-19 Thread Andres Reyes
I don't think you need two different login forms, it looks more like a UserProfile with field in it saying something like EMPLOYEE_CHOICES = ( (1, 'employer'), (2, 'employee'), ) employee_type = models.IntegerField(choices=EMPLOYEE_CHOICES) 2012/1/19 Jesramz : > I would like to separate

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-12 Thread Andres Reyes
You mean that the webserver that Django itself recommends in https://docs.djangoproject.com/en/dev/howto/deployment/ is not a good choice? 2012/1/12 Stuart Laughlin : > > On Thursday, January 12, 2012 10:09:13 AM UTC-6, Javier Guerra wrote: >> >> On Thu, Jan 12, 2012 at 9:54 AM, Stuart Laughlin >

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-12 Thread Andres Reyes
What are you triying to achieve? 2012/1/12 Juergen Schackmann : > can really no one help? i am really stuck here at the moment > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.goog

Re: How to encrypt DateTimeField in models.py ?

2012-01-09 Thread Andres Reyes
Looking at the log it seems your underliying database has DATE type for the column when it should be a VARCHAR or the like 2012/1/9 Nikhil Verma : > Hi > > I am having a requirement that i have to encrypt some of the fields in a > table. > I am using Django 1.3.1 and postgres 9.1. I am referring t

Re: Model for images with thumbnails

2012-01-06 Thread Andres Reyes
I've found that the most flexible approach is the one taken by http://thumbnail.sorl.net/ 2012/1/6 Иван Иванов : > На Fri, 6 Jan 2012 07:08:59 -0800 (PST) > francescortiz написа: > >> you can try https://github.com/francescortiz/image > > or you can try https://github.com/SmileyChris/easy-thumbna

Re: Using STATIC_URL in CSS/JS files?

2012-01-02 Thread Andres Reyes
If you're serving your media from the same domain as your CSS i'd use relative paths 2012/1/2 Christophe Pettus : > > On Jan 2, 2012, at 5:56 PM, Victor Hooi wrote: >> E.g. I have a CSS file that points to a PNG sprite, and I'd like a way to >> get it to point to {{ STATIC_URL}} without hardcodin

Re: How do I prevent messages getting cached?

2011-12-19 Thread Andres Reyes
You could use the cache template tag https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching And cache only certain parts of your template and not all of it 2011/12/18 Nathan Geffen : > Hi > > I am using per-view caching in version 1.3 and would prefer to avoid > caching in

Re: urlresolver and custom Site model?

2011-12-07 Thread Andres Reyes
Also you can use FORCE_SCRIPT_NAMEin your settings 2011/12/7 Daniel Roseman > On Wednesday, 7 December 2011 12:49:47 UTC, aleksandra...@googlemail.comwrote: >> >> Hello everyone >> >> Becuase I do not use django database at a

Re: Internationalization and localization

2011-12-06 Thread Andres Reyes
At the moment i don't know of any official support for that kind of internationalization from Django, there are a number of different Packages that try to address the problem with some level of success. In one project of mine i used the approach described in http://snippets.dzone.com/posts/show/297

Re: Automatically direct unauthenticated users to homepage

2011-11-15 Thread Andres Reyes
You could also use the login_required decorator with the method decorator in the dispatch method of your view 2011/11/15 CrabbyPete > Ivo, > > Thank you. I was not using the @login_required decorator. I was using > generic classes like FormView and TemplateView but I see that in order > use logi

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Andres Reyes
Glad to be able to help 2011/11/10 Micky Hulse > On Thu, Nov 10, 2011 at 3:47 PM, Micky Hulse wrote: > > Whoa! That works perfectly! > > Ack! I spoke too soon. > > My context variable name of "user" conflicted with the current > logged-in user (looks like there's already a "user" variable float

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Andres Reyes
See https://gist.github.com/1356199/bd1af5e81d51ef32a3f4aa29a7a9120c9a8ffe85 The problem is that you're overriding get_queryset when you should be overriding get_object 2011/11/10 Micky Hulse > Hello, > > I am in the process of upgrading this "old" functional code: > > urls_old.py: >

Re: Get the current url in django template

2011-11-10 Thread Andres Reyes
To use the request object in a template you need django.core.context_processors.request in your TEMPLATE_CONTEXT_PROCESSORS 2011/11/10 Martin Pajuste > If you need something like " > http://example.com/music/bands/the_beatles/?print=true"; try > {{request.build_absolute_uri}} > > https://docs.d

Re: maultiple .js files for debug and one minimized .js for production

2011-11-08 Thread Andres Reyes
I've been using django-compressor and totally recommend it https://github.com/mintchaos/django_compressor 2011/11/8 Gelonida N > Hi, > > > I'm having an rather weak (CPU) server accesible over a rather slow > network. > > Therfore my plan is to use > multiple readable debuggable css files for

Re: Catching the autogenerated admin post

2011-09-29 Thread Andres Reyes
You could try doing your processing in the save_model method of ModelAdmin https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model 2011/9/29 bazaarsoft > Hello - I'm new to Django and love what I see so far. I have the need > to "catch" the admin post

Re: Internationalization

2011-09-22 Thread Andres Reyes
If you could provide more information as to what you don't understand and what have you tried so far we could be of more assistance 2011/9/22 nadae ivar > i check it but not undestand > > On Sep 22, 10:40 am, Maksymus007 wrote: > > and of course you did check django documentation under > intern

Re: Comment Framework and Session Variables

2011-09-21 Thread Andres Reyes
One possible way would be to create your own template tag and use it instead of the provided one. I did it recently and it's not that complicated, you should use the code for the current one as an starting point and just extend it to accept some custom parameter you provide, in this case the email

Re: request.method not working as expected

2011-09-20 Thread Andres Reyes
I believe that the best practice is to always use the {% url %} template tag and not hardcoding your URL's 2011/9/20 Fabio Natali > On 09/20/2011 07:15 PM, dm03514 wrote: > >> Fabio in your dev server output is it saying the type of request is >> get? >> ARe you accessing "/method/" through your

Re: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Andres Reyes
Actually the solution is to define a verbose_name and a verbose_name_plural in your model's Meta class MyModel(models.Model): field = models.CharField(max_length=200) class Meta: verbose_name = 'My model's name' verbose_name_plural = 'My model's name in plural context' E