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/d/msg/django-users/-/8FA1wqrnhLEJ.
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: 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 self.user to self.workplace ?
self.assertEqual(self.workplace.employees_set.all(), 1)


Note that you probably want to use create instead of build so that the 
objects are saved to the database

 
On Tuesday, November 20, 2012 11:36:16 AM UTC-6, Craig Blaszczyk wrote:
>
> Hi Guys,
>
> I'm using FactoryBoy in my tests, but I have a model which has 
> a ManyToManyField to another model. Does anyone know if it's possible to 
> make factoryboy use a factory to represent this relationship?
>
> For reference, here are a sample model and factory:
>
> --models.py
> from django.contrib.auth.models import User
> from django.db.models import ManyToManyField
> class Workplace(models.Model):
> employees = ManyToManyField(User)
>
> --tests.py
> import factory
> from models import Workplace
>
> # This will set the default strategy for all factories that don't define a 
> default build strategy
> factory.Factory.default_strategy = factory.BUILD_STRATEGY
>
> class WorkplaceFactory(factory.Factory):
> FACTORY_FOR = Workplace
>
>
> class UserFactory(factory.Factory):
> FACTORY_FOR = User
>
>
> class ATestCase(TestCase):
>
> def setUp(self):
> super(ATestCase, self).setUp()
> self.user = UserFactory.build()
> self.workplace = WorkplaceFactory.build()
>
> def test_foobar(self):
> # how do I add self.user to self.workplace ?
> self.assertEqual(self.workplace.employees_set.all(), 1)
>
>
>
> --Craig
>

-- 
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/d/msg/django-users/-/PO1F2ERL5CwJ.
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: 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 capable of centralizing the generation of office documents. 
>
> This work was made on behalf of my employer Magenta ApS - the code is 
> available on the Subversion server for the Danish Agency for 
> Digitisation 
> <
> http://www.digst.dk/da/Servicemenu/English/About-the-Danish-Agency-for-Digitisation>,
>  
>
> if anyone is interested: 
>
> https://svn.softwareborsen.dk/DokumentBroker/ 
>
> As it is, the installation procedure is: 
>
> * Get the code directory by unpacking the tarball or checking out the code 
>
> * Check the INSTALL file for dependencies, install all dependencies 
> (Debian/Ubuntu is strongly preferred) 
>
> * Run the "create_virtualenv" bash script to create the Python 
> virtualenv and install Django and a lot of Python packages 
>
> * Softlink or copy the Apache config files to 
> /etc/apache2/sites-available, manually update paths, etc. 
>
> * Create the necessary databases and update the settings.py files of the 
> two sites. 
>
> We'd like to be able to automate all of this, so that the user can 
> install these two services by running a single installation script. 
>
> I'm working on how to create source distribution tarballs with 
> setuptools and a setup.py file. However, setuptools and distutils will 
> only *install* my packages as Python packages and not set up the sites, 
> and that is *not* what we want. We'd like to create a complete 
> installation program so the user could just 
>
> * grab the tarball 
> * run "sudo install.py" or whatever 
> * enter some ports and paths configuration 
> * and now, up and running. 
>
> But how do I do that for a web service which is really a complete Django 
> site? Setup.py is obviously the Python Way of installing packages, but 
> is there a Django Way of creating and distributing installation programs 
> for web services which are entire site implementations? 
>
>
> best regards and thanks in advance, 
>
> Carsten Agger 
>
>
> -- 
> Carsten Agger 
> Magenta ApS 
> �bogade 15 
> 8200 �rhus N 
>
> Tlf +45 5060 1269 
> Mob +45 2086 5010 
> http://www.magenta-aps.dk 
> cars...@magenta-aps.dk  
>
>

-- 
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/d/msg/django-users/-/_KqRLWLILPoJ.
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: 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, how is
> installing Django the same way that I install any other application
> more of a risk?  If an installer tries to write to /usr/local/bin/,
> then it needs elevated permissions to do so.  I would assume from that
> point on, the remainder of the time, the program runs within the
> context of the user who executed it, just like any other shell
> commands like tar, ls, mv, rm, python, and so on.
>
> While the web server is running, wouldn't it execute any Django
> commands within the context of the web user, like www-data?  When I
> installed WSGI, I used Synaptic.  To use Synaptic, if you start it as
> a regular user, you have to give root password.  How would is that
> different?
>
> You may have very good answers.  I'm not saying I'm right and you're
> wrong.  But, I don't see the problem.
>
> On Mar 7, 4:21 pm, Andre Terra  wrote:
>> Again, don't install as root, use virtualenv. This will save you headaches
>> in the future, and unless you have an inexcusable reason to have Django run
>> as root, you shouldn't.
>>
>> Sincerely,
>> AT
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Mar 7, 2012 at 6:28 PM, backdoc  wrote:
>> > I think you might need to install as root or sudo.
>>
>> > From memory.
>>
>> > sudo python setup.py install
>>
>> > Also, try executing "which django-admin.py" at the terminal.  That
>> > will tell you the location of the executable.  Basically, I'm curious
>> > if it will even find it, as I'm thinking it didn't install at all.  I
>> > just installed the 1.4 rc last night on Debian.  I didn't have any
>> > issues.
>>
>> > On Mar 7, 8:36 am, Clark  wrote:
>> > > After installing Django I am attempting to start a new project.  After
>> > > creating a directory for this, I tried using the command: "django-
>> > > admin.py startproject mysite".
>>
>> > > but I'm getting the message "-bash: django-admin.py: command not found
>> > > ".
>>
>> > > So, I've tried running this:
>>
>> > > "sudo ln -s library/python/2.6/site-packages/django/bin/django-
>> > > admin.py /usr/local/bin/django-admin.py" in which i get "file exists"
>> > > and I still get the same problem when running the startproject.
>>
>> > > Only other piece of info is that during installation I had a "error: /
>> > > usr/local/bin/django-admin.py: No such file or directory".  But I can
>> > > cd into that directory and see the django-admin.py file.
>>
>> > > Thanks!
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>
> --
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: "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 the following error while saving an object from admin.
>>
>>  "model_name" object has no attribute '_adding'
>>
>> I am getting this error in clean method of some of my models where i
>> use it the following way:
>>
>> def clean( self ):
>>         from django.core.exceptions import ValidationError
>>         if self._adding: (do this)
>>         else: (do this)
>>
>> Please help if you have any clue, while i search for the fix.
>
> The _adding variable was moved to ModelState. So, above should read:
> if self._state.adding:
>
>  - Anssi
>
> --
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: "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 this)
   else: (do this)

2012/2/27 dizzydoc :
> Hi django users,
>
> I have just migrated my projected from django 1.2.7 to django 1.3.
>
> I am receiving the following error while saving an object from admin.
>
>  "model_name" object has no attribute '_adding'
>
> I am getting this error in clean method of some of my models where i
> use it the following way:
>
> def clean( self ):
>        from django.core.exceptions import ValidationError
>        if self._adding: (do this)
>        else: (do this)
>
> Please help if you have any clue, while i search for the fix.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 is not capitalized.  (Why on Earth doesn't the error
> message say: "The database 'Mydatabase' doesn't exist." ?)
>
> Thanks a lot for your time anyway!
>
>
> On Feb 17, 8:31 am, Dennis Lee Bieber  wrote:
>> On Thu, 16 Feb 2012 18:55:14 -0800 (PST), Ishmael 
>> wrote:
>>
>> >_mysql_exceptions.OperationalError: (1044, "Access denied for user
>> >'myuser'@'%' to database 'Mydatabase'")
>>
>> >My settings file contains:
>>
>> >DATABASES = {
>> >        'HOST': 'my.url.com',                      # Set to empty
>> >string for localhost. Not used with sqlite3.
>> >        'PORT': '3306',                      # Set to empty string for
>> >default. Not used with sqlite3.
>> >    }
>> >}
>>
>> >How do I get rid of the '%' percent symbol for the local hostname?
>>
>>         One -- you aren't using "localhost" to connect. Is MySQL's port open
>> to connections asking for "my.url.com".  That is, rather than connecting
>> to (localhost, MySQLPort) you are connecting via (my.url.com,
>> MySQLPort). {BTW: you may also be caught be another twitch -- about a
>> quarter way downhttp://dev.mysql.com/doc/refman/5.0/en/connecting.html
>> """
>> On Unix, MySQL programs treat the host name localhost specially, in a
>> way that is likely different from what you expect compared to other
>> network-based programs. For connections to localhost, MySQL programs
>> attempt to connect to the local server by using a Unix socket file.
>> """
>>
>>         Second -- if the port is open, have you added your user/password to
>> the NON-localhost account table (% is the wildcard for connecting host
>> address). The local tools are using localhost, not "my.url.com" to
>> connect.
>> --
>>         Wulfraed                 Dennis Lee Bieber         AF6VN
>>         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 Alessandro Candini :
> Hi list.
> I need to create an app in which the user can upload a shapefile, which must
> be stored in a database table with LayerMapping from
> django.contrib.gis.utils, as explained here:
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#layermapping
>
> The problem is that I need to update dynamically my models.py with a new
> model and add a table for every shape inserted by the user, without using
> syncdb.
>
> Trying to document myself about this topic, I encountered a lot of
> interesting extensions like south, django-eav and django-mutant for example.
> (An interesting discussion here:
> http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/7934577#7934577)
>
> But I'm very confused about what could be the best solution for my needs.
>
> Has anybody experience with this kind of tools?
>
> Thanks in advance.
>
> Alessandro
>
> --
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django 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 server, even
> though the whole application works fine, when I log into the admin I
> see nothing. No models, no auth. Just a stack of empty boxes.
> If anyone has any idea as to why this might be, your input would be
> much appreciated.
>
> Sam
>
> --
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 your fields and then pass it to
django-registraion

https://bitbucket.org/ubernostrum/django-registration/src/d073602dc103/registration/views.py#cl-76
https://bitbucket.org/ubernostrum/django-registration/src/d073602dc103/registration/forms.py#cl-21

2012/1/28 Jonathan Paugh :
> contrib.auth.models.User has a get_profile() hook that allows you to add
> extra info to a user account from your own model; however, I don't see
> support for that in django-registration at first glance.
>
> I'm looking at the code from
> https://bitbucket.org/ubernostrum/django-registration/
>
> On 01/28/2012 11:59 AM, Zach wrote:
>> I am new to Django and have implemented the django-registration app on
>> my website. I want users to input their first name and last name on
>> the registration page. However, the default setting only ask users for
>> their email address/username/password . Is there an easy way to
>> address this?
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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 meant to be an employee can easily choose the employer
> option. I want to add permissions such that an employer can see
> employee profiles while the employee can't (a separate form might add
> a tiny bit more security, I think). Can you help me with this?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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 users into two different groups, employer or
> employee, at signup. I think the usual approach is to make two
> different sign-up forms one for the employer group and another for the
> employee group. I'm currently using django-userena. What would I have
> to do to get this working? How do I add the user to the group?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 
>> wrote:
>> >  # author admits he is a non-sysadmin noob
>>
>> ad-hominem
>
> False. I pointed out what the author clearly stipulates.
>
> "I’m a sys admin NOOB. I am also teaching myself to code. This is my first
> time setting up this stack so there are probably going to be some
> bugs/security issues I conveniently side stepped just to get it to work."
>
> "This is obviously not secure enough for a ‘production’ environment."
>
> If that's what you want to model your deployment after, be my guest. I
> hardly think it's fallacious of me to suggest someone do otherwise.
>
>
>>  # he uses apache instead of... well... anything else
>>
>> well-tuned apache and mod_wsgi is on the same league as the cool boys.
>>  (i still prefer nginx, and i don't think this is a good example of
>> apache tuning, but nothing bad about it)
>
> I don't care a whit about what "the cool boys" are doing. What I care about
> is a production deployment that works efficiently and reliably and that is
> diagnosable when something doesn't work. Apache fails those criteria; nginx
> and lighttpd pass (in my opinion and the opinion of many other developers
> who have used these technologies for non-trivial web applications in
> production environments).
>
>>
>> > Bonus reason:
>>
>> >  # he uses mysql instead of postgres
>>
>> again, might not be the bestest choice but nowhere near a bad one.
>
> That's why I listed it as a bonus reason. Better than mssql and sqlite for a
> production deployment anyway, eh?
>
>
> --Stuart
>
> --
> 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/d/msg/django-users/-/ByBrEdUj8HUJ.
>
> 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.



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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.google.com/d/msg/django-users/-/RYLQqxJE7HYJ.
>
> 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.



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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 to this app
> django-fields :-
>
> https://github.com/svetlyak40wt/django-fields/blob/master/src/django_fields/fields.py
>
> Here is my code :-
>
>     patient_type = EncryptedCharField(max_length=80,
> choices=CHOICES.PATIENT_TYPES)
>     date_of_birth = EncryptedDateField(null=True, blank=True)
>     gender = EncryptedCharField(max_length=1024, choices=CHOICES.GENDERS,
> blank=True)
>     contact_phone = EncryptedCharField(max_length=1024, blank=True)
>     security_question = models.ForeignKey(SecurityQuestion, null=True,
> blank=True)
>     security_answer = EncryptedCharField(max_length=1024, null=True,
> blank=True)
>
> It stores everything in encrypted form in the database except
> date_of_birth.It throws this error
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
>   111. response = callback(request, *callback_args,
> **callback_kwargs)
> File
> "/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/utilities/decorators.py"
> in _dec
>   14. return view_func(request, *args, **kwargs)
> File
> "/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/visit/views.py"
> in setup
>   202. patient.save()
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
> save
>   460. self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
> save_base
>   553. result = manager._insert(values,
> return_id=update_pk, using=using)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in
> _insert
>   195. return insert_query(self.model, values, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in
> insert_query
>   1436. return query.get_compiler(using=using).execute_sql(return_id)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in
> execute_sql
>   791. cursor = super(SQLInsertCompiler, self).execute_sql(None)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in
> execute_sql
>   735. cursor.execute(sql, params)
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in
> execute
>   34. return self.cursor.execute(sql, params)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
> in execute
>   44. return self.cursor.execute(query, args)
>
> Exception Type: DatabaseError at /visit/setup/
> Exception Value: invalid input syntax for type date:
> "$AES$55403376ed906e119b0f7779554fbb51"
> LINE 1: ...L, NULL, '$AES$0452edae035cc33c4084e7b0fb39edd7', '$AES$5540...
>  ^
> Any help will be appreciated.
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
> --
> 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.



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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-thumbnails
>
>> On 6 ene, 12:35, MeME  wrote:
>> > Hello,
>> >
>> > I'm new to Django. I started to write something for personal
>> > purposes.
>> > I have doubts about writing model for media files, especially
>> > images. In my app thumbnails should be automatically created when
>> > image is uploaded. Each such image can have thumnails with different
>> > dimensions. Images can be attached to posts.
>> >
>> > The question is how to store such information in database?
>> >
>> > Should it be separate records for each thumbnail and main image? And
>> > how to keep relationship?
>> >
>> > Or maybe I could store everything in one record as a serialized data
>> > (as in Wordpress)? Then I could as well store there HTML for image
>> > and metadata.
>> >
>> > --
>> > Regards
>> > MM
>>
>
> --
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 hardcoding the URL/path - any way?
>
> You can use Django to serve your CSS file if you want to, although you'll 
> want to cache the heck out of it for performance reasons.  There are also a 
> wide variety of tools which generate CSS from various input files to allow 
> for various kind of template expansion, and those might be a suitable 
> alternative.
>
> --
> -- Christophe Pettus
>   x...@thebuild.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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 my templates as far as possible. However, I've hit a snag.
> If the messaging framework generates a message for a cached view, one
> of two things happen:
>
> 1. If the page is not yet in cache, the page gets cached with the
> message in it. So next time a user goes to the page, they get an old
> message.
>
> 2. If the page is already in cache, the message isn't displayed.
>
> Is there a simple way to address this? Perhaps something I can put in
> a vary_on_headers decoration? Or is there a simple way to tell Django
> to put the message into a query string so that the page with the
> message is cached separately from the page without the message?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 all my application currently
>> can't be deployed to a custom location different from "/" quite
>> simply. I use {% url ... %} template tags within templates and
>> django.core.urlresolvers.**reverse to populate urls. The problem is that
>> if I deploy myapp under http://host:port/MYSAPCE/myapp and site_id is
>> not defined in db the url is not picking "MYSAPCE".
>>
>> What I am trying to do now is to write my own site model (without
>> using django database) that would be used by urlresolver. I was
>> wondering if someone could point me how that should be done.
>>
>> Thanks
>> Alex
>>
>
> How are you deploying your application? There should be no need for a
> custom urlresolver - Django uses the SCRIPT_NAME value which should be set
> by your webserver. If that's not working for you, you may have something
> wrong in your hosting setup.
> --
> DR.
>
> --
> 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/d/msg/django-users/-/IF09jV7YDwkJ.
>
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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/2979 . You must remember however that
in the end Django Models are only a representation of the data in your
database, you can design you database to handle multiple languages just as
you would wth PHP or any other framework.



2011/12/5 rentgeeen 

> I have a question about internationalization -
> https://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>
> What I want to how to translate stuff from DB, all at django official
> say is about static content, what I have only found is this:
>
> http://packages.python.org/django-easymode/i18n/index.html
>
> Easymode
>
> I think there is more official way from Django no?
>
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 login_required I have to put it in the url.py file and edit the
> settings.LOGIN_URL to point to my login page.
>
>
>
>
> On Nov 15, 11:25 am, Ivo Brodien  wrote:
> > Hi,
> >
> > these views are protected by @login_required view, right?
> >
> > If so, users that are not logged in should be redirected to the login
> view.
> >
> > If you are not using the decorator, how are you handling users that are
> not logged in these different views? You are probably doing something
> against the DRY principle.
> >
> > bye
> > Ivo
> >
> > On Nov 15, 2011, at 17:16 , CrabbyPete wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I have a site with lots of views. When someone comes to my site and is
> > > not logged in I direct them to the homepage to login. However a user
> > > could type in a whole url for a view and it will go there and cause an
> > > error because the view expects the user to be logged in. I could put
> > > logic in every view to see if the user is logged in but it seems
> > > redundant. Is there a way to force anonymous users to the home even if
> > > they type in a full url to a specific view
> >
> > > --
> > > 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 athttp://
> groups.google.com/group/django-users?hl=en.
> >
> >
> >
> >  smime.p7s
> > 5KViewDownload
>
> --
> 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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 floating
> around at the template level... I assume this variable comes from the
> "django.contrib.auth.context_processors.auth" middleware?)
>
> Quick fix was to set context_object_name = 'member' and update my
> template code to match the variable name change
> {{member.get_user_profile}} and everything is working perfectly!
>
> I am not sure why the old functional view did not exhibit the same
> variable name conflict.
>
> Anyway, thanks again Andres!
>
> Cheers,
> M
>
> --
> 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 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:
> 
>
> views_old.py:
> 
>
> Here's what I have so far:
>
> urls.py:
> 
>
> views.py:
> 
>
> -
>
> I just have a few questions:
>
> 1.
>
> How can I access kwargs from the URL?
>
> When I try self.kwargs['username'] I get this error:
>
> "Generic detail view UserDetail must be called with either an object
> pk or a slug."
>
> 2.
>
> All I want to do is pass "user" and "profile" to my template...
> Looking at my class-based view/url, am I going about this right (other
> than the error)?
>
> As it stands now, my "new" code seems kinda convoluted; having to say
> "self.profile" and then call get_context_data just to pass "profile"
> seems like a lot of extra work when compared to the older
> function-based view.
>
> -
>
> Any tips ya'll could provide would be extremely helpful! :)
>
> Thanks in advance!
>
> Cheers,
> M
>
> --
> 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.build_absolute_uri
>
> --
> 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/d/msg/django-users/-/PzqmOq5u8ysJ.
>
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 debugging and
> a single, minizmized  .js for for production.
>
> This will affect some of my templates.
>
> How do you handle this setup in your projects.
>
> If statements in the templates?
> multiple template files and copying over one or the other?
> ???
>
> In order to build the minimized files?
> Is there any 'intelligent' plugin, which can locates and minimizes all
> the .js files or do you go for a make file like approach or just a
> simple script (finding / minimizing)
>
> Thanks in advance for any suggestions.
>
> --
> 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 for one of my models: essentially, the model
> contains a file and from the file I want to extract data for some of
> the other model fields that are required for that particular model.
> So, can I "break" into the admin form processing to get it or am I
> just going to have to build my own forms?
>
> Thanks - and sorry if this is covered in another post, I searched here
> and in the docs and didn't seem to come up with anything.
>
> jay
>
> --
> 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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
> internationalization
> > section?:)
> >
> > Pozdrawiam, Maksymilian Pawlak
> > 22-09-2011 12:30 użytkownik "nadae ivar"  napisał:>
> hi,
> > > i have a application in french i wanna use internationalization to
> > > change language at each request if the broswer in english turn it in
> > > english if the broser in french turn it in french
> >
> > > --
> > > 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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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
field.

Regards

2011/9/21 SixDegrees 

>
> I'm using the Django-supplied comment framework, and I would like to
> initialize the email field of the comment form with a value stored in a
> session variable. The forms, however, are created using template tags; they
> aren't instantiated in the view, for example, where I could easily provide
> the session value as part of the 'initial' dictionary. I don't see any way
> in the template to pass this value along so the form can make use of it.
> How
> can I do this?
> --
> View this message in context:
> http://old.nabble.com/Comment-Framework-and-Session-Variables-tp32503766p32503766.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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 form or are you just
>> directing your webserver to 
>> http://192.168.0.2:8000/**method/?
>> ??
>>
>
> Hi dm03514 and thanks for your help!
>
> Thanks to your suggestion I managed to resolve my issue. I looked at my
> development server logs and noticed 2 lines:
>
> [20/Sep/2011 12:17:27] "POST /method HTTP/1.1" 301 0
> [20/Sep/2011 12:17:27] "GET /method/ HTTP/1.1" 200 3
>
> I guess the lack of a trailing slash in my url was causing some sort of
> internal redirection. That redirection eventually caused the loss of POST
> stuff.
>
> I was using this:
>
>  action="http://192.168.0.2:**8000/method
> ">
> I changed that to:
>
>  action="http://192.168.0.2:**8000/method/
> ">
> and everything was fixed.
>
> Don't you think this is too fragile and error prone? I guess I may forget
> the trailing slash again in the future and that will mean the break of
> everything... Is there any best practice for this?
>
> Thanks! Greetings, Fabio.
>
>
> --
> Fabio Natali FNstudio
>
> --
> 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+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: 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'


El sábado 10 de septiembre de 2011, Christian Ramsey escribió:

> I believe you can use :
>
>   def __unicode__(self)
>
>   return 'Name you'd like without the s'
>
> for each model and this will be used instead.
>
> On 10 Sep 2011, at 14:40, Gillwill wrote:
>
> Apparently the Django default is to append the letter "s" to the end
> of the model name for each listed under a given application on the
> Site Administration page. (It does this in the tutorial sample site as
> well - e.g. naming "poll" "polls", etc...)
>
> Is there any way to get rid of that?
>
> I would think there would be, but I've yet to find in the default
> admin templates or code where it is doing this.
>
> Any help appreciated.
>
> -Gil
>
> --
> 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 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  '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 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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.