m2m admin relationship selector with filter_horizontal and large datasets

2014-12-09 Thread James Y
I have a Category model that is m2m with an Article model and need to make 
categories selectable in my article admin. So I'm using a filter_horizontal 
and the problem is that I have thousands of categories and do not want to 
load them all into the left hand side (lhs) of filter_horizontal.

Is there a way to limit the lhs to just a search functionality instead of a 
category browse?

Is there another widget I should use just for searching categories to make 
m2m relationships?

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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e38e12cd-b643-4617-b3ae-f83fc9b76425%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner: What are the pitfalls of using an html form without using django forms? I.e. form.py

2014-12-09 Thread mulianto
Hi Tdkwon,

What the benefits using django forms something like :

1. You can reuse it on another view programmatic way, not copy paste html only
2. You have the definition of form in  1 place rather distributed on many views 
to change it.
3. You have the helptext, error message, validation, css class 
4.little code in views to process form data and save to models

Try it and tou will found it more usefull

Regards,

Mulianto
Blog: http://muliantophang.blogspot.com


Sent from my iPhone

On 10 Des 2014, at 09:01, T Kwn  wrote:

> Thx for the explanation. I thought as much but as a beginner am always 
> worried about some unforseen consequence.
> 
> On Tuesday, December 9, 2014 1:26:47 AM UTC-8, Daniel Roseman wrote:
>> 
>> On Tuesday, 9 December 2014 01:37:44 UTC, T Kwn wrote:
>>> 
>>> I'm created a form where a user can add or remove other users from a group. 
>>> Because the number of available users is unknown beforehand, I needed to 
>>> create a checkbox form where the number of elements is dynamic. However, I 
>>> couldn't figure out how to do it so I just used an html form and some 
>>> . I then processed the result in my view. I do not 
>>> have any form defined in forms.py.
>>> 
>>>  I presume this is poor django practice but I'd like to know more details 
>>> on why. Obviously I'm not getting the built-in form validation but with 
>>> checkboxes it doesn't seem very necessary. Anything else?
>>> 
>>> My view can be seen here:
>>> 
>>> https://gist.github.com/anonymous/d1e8bd43c20eced9e4ce
>>> 
>>> The template code is pretty basic such as:
>>> 
>>> {% for myuser in members %}
>>> {{ myuser.username }}
>>> 
>>> 
>>> {% endfor %}
>> 
>> There's nothing wrong with doing that, of course. Just as you can write raw 
>> SQL to talk to your database, and even raw WSGI to power your web app. But 
>> Django provides utilities like the ORM, and the forms framework, to make it 
>> easier for you. If you find they don't help for your use case, then feel 
>> free not to use them.
>> --
>> DR.
> 
> -- 
> 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 django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/3e6d5ef4-ed66-46d1-9906-f2de823fb311%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EB8EB001-2DDC-4ACB-8EBF-1E2899781976%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Modify a queryset and add computed value to the objects

2014-12-09 Thread Russell Keith-Magee
Hi Karim,

On Wed, Dec 10, 2014 at 8:07 AM, Karim  wrote:

> Hi everyone! I have a "Services" model and I would like to get a
> QuerySet with all the services filtered based on the distance between
> the logged user and the service.
>
> I have latitude and longitude about the user logged in and I filter
> the services based on the computed distance.
>
> At the moment I build the QuerySet Service.objects.all() and after
> that I exclude the services that I don't need, but I think there is a
> better way to do that.
>
> I was thinking to use a Manager. Quoting the docs:
>
> "Adding extra Manager methods is the preferred way to add
> “table-level” functionality to your models. (For “row-level”
> functionality – i.e., functions that act on a single instance of a
> model object – use Model methods, not custom Manager methods.)"
>
> As a "eternal newbie" I ask you
>
> 1) The distance must be computed based on two parameters "long" and
> "lat". Is that possible to define a manager only for this purpose? Is
> it a good practice?
>

Only if you can perform that calculation "database-side". Since you want to
do a filtering operation, the property you want to filter on must either be
stored on the database, or computable via the database. Essentially, the
manager needs to be no more than a shorthand for a query chain using normal
Django query clauses. You can't use a method on the *model* because that
value will only exist on the Python side of the query, not the database
side.

(A quick caveat - you *could* do it by filtering on the Python side -
essentially, you filter as much as possible on the database, and then
provide a Python-side filter - essentially "[s for s in
Service.objects.all() if s.distance(some_user) < maximum_value]" - but that
puts additional load on your web server. If your list of services is short
to start with, or can be filtered to be relatively short, this might be a
viable option - YMMV)

In some cases, the database filtering can be helped by pre-computing a
filterable value and storing it as a value on the database model, so you
can use a simple Django filter on that value. However, in your case, it's
not just about the lat/long of the object being filtered, but the lat/long
of the user as well.

Managers themselves can't take arguments, so the closest you'll get is a
method *on* the manager that can return a queryset. The fact that the
method is on the Manager is largely irrelevant - that's just a convenience.
You need to be able to construct a query chain, using purely database-side
queries. Putting that method on the manager is really just a convenience to
put the query in an obvious place; being on the manager doesn't give the
query any additional power.

If you're using Django 1.7, you should also look into using custom query
sets *as* managers:

https://docs.djangoproject.com/en/1.7/releases/1.7/#calling-custom-queryset-methods-from-the-manager

This means you'll be able to access your "nearest filter" anywhere in a
query chain. After all - does it really matter if you say:

Services.objects.nearest(some_user).filter(is_fun=True)

or

Services.objects.filter(is_fun=True).nearest(some_user)

(Maybe it does in your particular case, but broadly speaking, it shouldn't).

You may also want to take a look at django.contrib.gis (also known as
GeoDjango):

https://docs.djangoproject.com/en/1.7/ref/contrib/gis/

This toolbox gives you a whole bunch of useful tools for performing
geographic queries, including computing the distance to a point,
determining if a point is inside a polygonal geographic boundary, and so
on. It's a little more difficult to set up, but it's much more powerful
(and accurate) than a simple lat/lng pair.

The Expressions API that will be part of Django 1.8 would also be useful to
you:

https://docs.djangoproject.com/en/dev/ref/models/expressions/

However, that would be riding the bleeding edge of Django, so unless you're
looking to be particularly adventurous, I'd stick to the more stable
options.


> 2) The computed value is not just useful for the QuerySet, but I need
> also that on client side so I serialize it and I send it using JSON.
> Is possible to make sure that the manager attach the field "distance"
> to the objects in the QuerySet?
>

If it's available for the database to filter, then it will automatically be
on the objects in the QuerySet, which means it will be available for
serialisation.

Yours,
Russ Magee %-)

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84-J--XpJL%3DJjaVqcvu1qcC7yUUxu%2BB98A8suMTNPqFYZA%40mail.gmail.com.
For more options, visit https

Re: Beginner: What are the pitfalls of using an html form without using django forms? I.e. form.py

2014-12-09 Thread T Kwn
Thx for the explanation. I thought as much but as a beginner am always 
worried about some unforseen consequence.

On Tuesday, December 9, 2014 1:26:47 AM UTC-8, Daniel Roseman wrote:
>
> On Tuesday, 9 December 2014 01:37:44 UTC, T Kwn wrote:
>>
>> I'm created a form where a user can add or remove other users from a 
>> group. Because the number of available users is unknown beforehand, I 
>> needed to create a checkbox form where the number of elements is dynamic. 
>> However, I couldn't figure out how to do it so I just used an html form and 
>> some . I then processed the result in my view. I do 
>> not have any form defined in forms.py.
>>
>>  I presume this is poor django practice but I'd like to know more details 
>> on why. Obviously I'm not getting the built-in form validation but with 
>> checkboxes it doesn't seem very necessary. Anything else?
>>
>> My view can be seen here:
>>
>> https://gist.github.com/anonymous/d1e8bd43c20eced9e4ce
>>
>> The template code is pretty basic such as:
>>
>> {% for myuser in members %}
>> {{ myuser.username }}
>> 
>> 
>> {% endfor %}
>>
>>
>>
> There's nothing wrong with doing that, of course. Just as you can write 
> raw SQL to talk to your database, and even raw WSGI to power your web app. 
> But Django provides utilities like the ORM, and the forms framework, to 
> make it easier for you. If you find they don't help for your use case, then 
> feel free not to use them.
> --
> DR.
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e6d5ef4-ed66-46d1-9906-f2de823fb311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Modify a queryset and add computed value to the objects

2014-12-09 Thread Karim
Hi everyone! I have a "Services" model and I would like to get a
QuerySet with all the services filtered based on the distance between
the logged user and the service.

I have latitude and longitude about the user logged in and I filter
the services based on the computed distance.

At the moment I build the QuerySet Service.objects.all() and after
that I exclude the services that I don't need, but I think there is a
better way to do that.

I was thinking to use a Manager. Quoting the docs:

"Adding extra Manager methods is the preferred way to add
“table-level” functionality to your models. (For “row-level”
functionality – i.e., functions that act on a single instance of a
model object – use Model methods, not custom Manager methods.)"

As a "eternal newbie" I ask you

1) The distance must be computed based on two parameters "long" and
"lat". Is that possible to define a manager only for this purpose? Is
it a good practice?

2) The computed value is not just useful for the QuerySet, but I need
also that on client side so I serialize it and I send it using JSON.
Is possible to make sure that the manager attach the field "distance"
to the objects in the QuerySet?

Thank you!

-- 
Karim N. Gorjux

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGUPt5f52oABVifeu2%3DPeYHLAAekrGwbVocvdDGQeyQJgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changes to Model does not migrate to sqlite with Django 1.7?

2014-12-09 Thread Tobias Dacoir
Hi,

I'm afraid I don't have them. Apparently after deleting my database file 
and then just running manage.py makemigrations, it deleted the old 
migration files and started anew. Right now I'm also unable to re-produce 
it on purpose :( But it happened a couple of times for me since I regularly 
make multiple changes to my model (I'm still at the beginning of 
development) but if I just add a single new field now it works as expected.

Maybe sometimes Django can't detect changes to my file because I store my 
project in my dropbox folder and maybe this might be messing it up?

On Monday, December 8, 2014 1:04:37 PM UTC+1, Markus Holtermann wrote:
>
> I tried to reproduce the problem with the steps you explained, but it 
> works fine for me. Can you post your existing migration files for that app 
> too, please. This will then hopefully give us some hints to solve your 
> problem.
>
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/530b0a83-e651-45b7-9b39-1169acc0a979%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changes to Model does not migrate to sqlite with Django 1.7?

2014-12-09 Thread Tobias Dacoir
Yes of course. Like I said, when I run into this error I have to delete my 
database file and do a fresh migration anyway.

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84327fd5-0381-4ed9-af32-913db71c4544%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice on creating an SFTP frontend in Django

2014-12-09 Thread Андрей Максимов
Hi Paul. 
I hope you moved to your final goal. Now before me there is the same 
objective is to make a simple Client Area that allows the downloading of 
files hosted on SFTP. 
Unfortunately I can not help you with your questions but I hope if you are 
advanced 
with this issue, you will be able to tell a little detail as you have 
implemented it.
T
hanks in advance.

среда, 3 июля 2013 г., 23:43:27 UTC+4 пользователь Paul Hudson написал:
>
> Hi,
>
> I have successfully used django-storages (
> http://django-storages.readthedocs.org/en/latest/index.html)  and 
> paramiko directly to log into an SFTP server and list a directory.  My end 
> goal is to make a simple Client Area that allows the downloading of files 
> hosted on SFTP.  I am open to any advice.  But here are a few specific 
> questions:
>
>
>1. How should I handle authentication?  Use django's built in 
>authentication and pass the usr/pwd onto the SFTP? (is that possible in a 
>secure way?)  Authenticate directly against SFTP server in a secure way?
>2. Are files going to be transferred twice?  Once from SFTP to temp 
>area on Django server.  And then downloaded via client's web browser...  
> Am 
>I just better off hosting the files on the web server to begin with?  (The 
>files need to be available on SFTP and via web browser.  Maybe instead of 
>direct access to SFTP via Django, I should focus on a simple way to post 
>the original files to both places???)
>3. Are they any Django Projects/Plugins/Components for File 
>Explorer/FTP Client type GUIs that you would recommend using or 
> referencing?
>
>
>
> Thanks for any and all input!
> -Paul
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/959743f9-8a4a-4ea4-b546-cc4ecc440546%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open a url with user and password

2014-12-09 Thread Florian Schweikert

On 2014-12-07 11:48, Hossein Rashnoo wrote:

Please help me.


this is quite unrelated to django, maybe it would be better asking this 
question on the python mailinglist[1]


-- Florian

[1] https://www.python.org/community/lists/

--
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/82d1df1fcd1f0e219d3be04dd04e5a0e%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


Re: Django server and Apache serving static files

2014-12-09 Thread Collin Anderson
Hi,

There's a good Apache example here if you haven't seen it.

https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-files

Collin

On Monday, December 8, 2014 9:32:07 AM UTC-5, pythonista wrote:
>
> My apache admin is having problems serving static files to the django app.
>
>
> Apache is on its own server.
>
> My admin says that he needs a relative path defined in Django in order to 
> get Apache to serve the static files from that server for the Django App
>
> Is it possible to define relative paths in the settings file to comply 
> with the requirements of Apache?
>
> And if it is possible can I still use the {%load staticfiles %}  variable.
>
> If this is possible, what would the relevant settings file entries be?
>
> 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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67b937d6-90b7-4d70-a720-f3e4db7d8953%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changes to Model does not migrate to sqlite with Django 1.7?

2014-12-09 Thread Collin Anderson
Hi,

Another silly question: have you made the initial migration(s) for your app 
yet?

Collin

On Monday, December 8, 2014 6:07:11 AM UTC-5, Tobias Dacoir wrote:
>
> Ok, here is part of the User Model:
>
> class User(AbstractBaseUser, PermissionsMixin):
>
> SEX = (
> ('m', 'male'),
> ('f', 'female')
> )
>
> RANG = (
> ('b', 'beginner'),
> ('e', 'expert'),
> ('m', 'master')
> )
>
> username = models.CharField(_('username'), max_length=30, unique=True,
> help_text=_('Required. 30 characters or 
> fewer. Letters, numbers and @/./+/-/_ characters'),
> validators=[
> validators.RegexValidator(re.compile(
> '^[\w.@+-]+$'), _('Enter a valid username.'), _('invalid'))
> ])
> first_name = models.CharField(_('first name'), max_length=30, blank=
> True, null=True)
> last_name = models.CharField(_('last name'), max_length=30, blank=True
> , null=True)
> email = models.EmailField(_('email address'), max_length=255, unique=
> True)
>
> is_staff = models.BooleanField(_('staff status'), default=False,
>help_text=_('Designates whether the 
> user can log into this admin site.'))
>
> is_active = models.BooleanField(_('active'), default=True,
> help_text=_('Designates whether this 
> user should be treated as active. Unselect this instead of deleting 
> accounts.'))
> date_joined = models.DateTimeField(_('date joined'), default=timezone.
> now)
> expires = models.DateTimeField(_('expiration date'), default=
> one_year_from_now)
>
> age = models.IntegerField(blank=True, null=True)
> sex = models.CharField(max_length=1, choices=SEX, blank=True)
> native_language = models.CharField(max_length=200, blank=True)
> english_proficiency = models.CharField(max_length=100, blank=True)
> audio_device = models.CharField(max_length=200, blank=True)
> autoplay_enabled = models.BooleanField(default=True)
>
> USERNAME_FIELD = 'username'
> REQUIRED_FIELDS = ['email', ]
>
> objects = UserManager()
>
> class Meta:
> verbose_name = _('user')
> verbose_name_plural = _('users')
>
> def get_full_name(self):
> full_name = '%s %s' % (self.first_name, self.last_name)
> return full_name.strip()
>
> def get_short_name(self):
> return self.first_name
>
> """
> def is_active(self):
> return timezone.now() <= self.expires
> """
>
> def email_user(self, subject, message, from_email=None):
> send_mail(subject, message, from_email, [self.email])
>
>
>
> (I removed some unrelated fields).
> Now what I did was add the autoplay_enabled feature yesterday which wasn't 
> there before. After adding this field, I saved the models.py ran manage.py 
> makemigrations (no changes detected) and then still tried to run manage.py 
> migrate.
> After starting the server when I tried to log into the Admin panel with 
> the Admin user (the DB was already populated by the Admin user, two more 
> users and other stuff) it gave me an OperationalError: column 
> autoplay_enabled does not exist. 
>
> This happened to me a lot of times when I added new fields to any of the 
> models. I ended up writing a script that pre-populates the DB for me but I 
> still have to manually delete my sqlite file, run migrations or syncdb and 
> then create the superuser again. 
>
> So what am I doing wrong? I'm sure it's just my fault. At first I even 
> manually edited the migrations file in the past, for example when I changed 
> one of the fields to be mandatory instead of being optional. Old data in 
> the database had this field still set to null, and sometimes Django asked 
> me what to do with it but most of the time I never got it to work correctly 
> - so again delete DB and repeat.
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3456c3f1-8b85-4533-a1e1-3788e2b1aa47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open a url with user and password

2014-12-09 Thread Erik Cederstrand

> Den 09/12/2014 kl. 14.39 skrev Collin Anderson :
> My first guess is that it's using NTLM authentication instead of basic auth. 
> If you curl -i http://portal:8080/ what "authenticate" headers do you get?
> 
> Also, you should consider upgrading to python 2.7 if you haven't :)

And nobody should need to look at urllib code anymore, either :-) Use requests 
instead, and https://github.com/requests/requests-ntlm if you need NTLN 
authentication.

Erik

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/49DA6B8A-5E0C-4994-955A-84C3865A3B0A%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Local timezone in django admin

2014-12-09 Thread Collin Anderson
Hi Vamsy,

What database are you using?

Collin

On Monday, December 8, 2014 4:35:46 AM UTC-5, vamsy krishna wrote:
>
> Hi,
>
> The default timezone in our application is UTC (stored in the database). 
> However I would like to display the datetime fields on the admin interface 
> based on the user's local timezone. We're using Django 1.6. 
>
> Thanks,
> Vamsy
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/38e64347-888b-49db-97f8-c11fc0e39fc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-reversion live site with source code

2014-12-09 Thread Collin Anderson
Hi,

I used it may years ago, though don't currently. I think it's really as 
simple the example in the docs:

import reversion

class YourModelAdmin(reversion.VersionAdmin):
pass

admin.site.register(YourModel, YourModelAdmin)

http://django-reversion.readthedocs.org/en/latest/

Collin

On Monday, December 8, 2014 3:30:41 AM UTC-5, wwiras wrote:
>
> Hi!
>
> Is there any django sites that are using django-reversion for me to see 
> the demo and download the source code for a better understanding on how its 
> work. Help is needed.
>
> Regards,
>
> wwiras
>
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e31978b-4fc7-4d1e-bb25-593563641538%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I cannot connect with my database remote server mysql django

2014-12-09 Thread Collin Anderson
Hi,

Also, make sure that the remote server allows for remote connections to 
your database using your username.

Collin


On Sunday, December 7, 2014 9:28:49 AM UTC-5, rush wrote:
>
> Just put correct password into settings. That will fix the error.
>  
> -- 
> wbr,
> rush.
>  
>  
>  
> 07.12.2014, 17:11, "tuktuk" >:
>
> I am running my django Application in local mode, and my database server 
> is in a remote server with cpanel. Configurations in settings.py are:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', 
> 'NAME': 'tim_farmaapp',  
> 'USER': 'tim_farmaapp',
> 'PASSWORD': 'mypass_123_',
> 'HOST': 'stevie.heliohost.org', 
> 'PORT': '3306',  
> }}
>
> But when i make syncdb i get this error:
>
> OperationalError: (1045, "Access denied for user 
> 'tim_farmaapp'@'31.44.78.126' (using password: YES)")
>
> How can i fix this issue/error ? Thanks to all !
>
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79d551ff-0853-43c4-a648-a5395eac9acc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connect django project with sharepoint 2013

2014-12-09 Thread Collin Anderson
Hi,

You may have better luck using the ip address directly instead of "portal".

Collin

On Saturday, December 6, 2014 11:46:23 PM UTC-5, Hossein Rashnoo wrote:
>
> I need this connection for adding list items and save my users data on 
> sharepoint database. I ran it in command line and when i write something 
> like """ print site.lists[0] """ this error appear :
>
>
>   File "", line 1, in 
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
> line 84, in __getitem__
> return self.all_lists[key]
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
> line 36, in all_lists
> result = self.opener.post_soap(LIST_WEBSERVICE, xml)
>   File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in 
> post_soap
> response = self.opener.open(request)
>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
> response = self._open(req, data)
>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
> '_open', req)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
> result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
> return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
> raise URLError(err)
> URLError: 
>
>
> On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte 
> wrote:
>>
>> Ok, but I am not sure what this has to do with Django ? Maybe you should 
>> ask on a SharePoint mailing list ? And did you try running the code in a 
>> script on the command line ? 
>>
>> François 
>>
>> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo  wrote: 
>> > 
>> > I need to connect my project to sharepoint. So i installed "sharepoint 
>> 0.4.1" package and then use this code in my view : 
>> > 
>> > from sharepoint import SharePointSite, basic_auth_opener 
>> > 
>> > def userloginres(request): 
>> > server_url = "http://portal:8080/"; 
>> > site_url = server_url + "rashno/" 
>> > opener = basic_auth_opener(server_url, "my username", "my 
>> password") 
>> > site = SharePointSite(site_url, opener) 
>> > 
>> > htt=r"Sharepoint lists" 
>> > for sp_list in site.lists: 
>> > htt = htt + r" %s . %s " % 
>> > (sp_list.id,sp_list.meta['Title']) 
>>
>> > htt = htt + r"" 
>> > 
>> > t = get_template('userlogin/userloginres.html') 
>> > html= t.render(Context({"htt":htt})) 
>> > return HttpResponse(html) 
>> > 
>> > But now when i open that url this error appear: 
>> > 
>> > URLError at /test/login/ 
>> > 
>> >  
>> > 
>> > -- 
>> > 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...@googlegroups.com. 
>> > To post to this group, send email to django...@googlegroups.com. 
>> > Visit this group at http://groups.google.com/group/django-users. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%40googlegroups.com.
>>  
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d436c9d-6454-44c0-b2e4-22bd1dcb9f97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open a url with user and password

2014-12-09 Thread Collin Anderson
Hi,

My first guess is that it's using NTLM authentication instead of basic 
auth. If you curl -i http://portal:8080/ what "authenticate" headers do you 
get?

Also, you should consider upgrading to python 2.7 if you haven't :)

Collin

On Sunday, December 7, 2014 5:48:02 AM UTC-5, Hossein Rashnoo wrote:
>
> I want to create a web-service for connection to sharepoint that do 
> something like create a list and ...
> So at first step because we use sharepoint with local ip i want to check 
> if i can connect to our sharepoint portal via my server or not.
> So i looking for something like : urllib2.urlopen("http://portal:8080/
> ").read()
> and i found this code for test:
>
> import urllib.request# Create an OpenerDirector with support for Basic HTTP 
> Authentication...auth_handler = 
> urllib.request.HTTPBasicAuthHandler()auth_handler.add_password(realm='PDQ 
> Application',
>   uri='https://portal:8080/',
>   user='my username',
>   passwd='my password')opener = 
> urllib.request.build_opener(auth_handler)# ...and install it globally so it 
> can be used with 
> urlopen.urllib.request.install_opener(opener)urllib.request.urlopen('http://portal:8080/')
>
> But after last line i got this error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
> return _opener.open(url, data, timeout)
>   File "/usr/lib64/python2.6/urllib2.py", line 397, in open
> response = meth(req, response)
>   File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
> 'http', request, response, code, msg, hdrs)
>   File "/usr/lib64/python2.6/urllib2.py", line 435, in error
> return self._call_chain(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
> result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default
> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> HTTPError: HTTP Error 401: Unauthorized
>
> Please help me.
>
>
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ffcb3bbd-8903-4436-b81a-18319a6ec476%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-09 Thread Collin Anderson
Hi,

On the html form, you could probably use javascript to filter out the value 
in the many to many when you select the primary language.

In the django form, you could add extra validation by defining 
form.clean_further_languages(self)

Collin

On Sunday, December 7, 2014 12:37:22 AM UTC-5, inoyon artlover KLANGRAUSCH 
wrote:
>
> Hi Collin, yes exactly. It is as follows:
> User can select a main coummunication language which is connected as 
> ForeignKey to the main langauges table.
> Withn the field below the user can select further languages but when I 
> select english as main language,
> this language shouldn't be available within the ManyToMany.. 
>
> Am Samstag, 6. Dezember 2014 18:25:59 UTC+1 schrieb Collin Anderson:
>>
>> Hi,
>>
>> Are you saying you have a ForeignKey choice field on the same form (above 
>> the ManyToMany), and when you change the choice field it should change the 
>> available values in the ManyToMany?
>>
>> Collin
>>
>> On Thursday, December 4, 2014 7:20:13 PM UTC-5, inoyon artlover 
>> KLANGRAUSCH wrote:
>>>
>>> Very cool! :) Many thanks, once more! :) Could be off-topic, but there 
>>> is somethin more tricky:
>>> Before a ManyToManyField there is one ForeignKeyField which has few of 
>>> the same values. 
>>> So the ForeignKey-value has to be excluded from the ManyToMany choices. 
>>> For example 
>>> the ForeignKey selection (labeld as: additional values) could trigger on 
>>> submit a queryset and 
>>> a view colud display the filterd ManyToManyField... (btw. I am very new 
>>> to python/django so..
>>> try'n error is the tedious way to go since two month... )
>>>
>>>
>>> Am Freitag, 5. Dezember 2014 00:52:18 UTC+1 schrieb larry@gmail.com:

 On Thu, Dec 4, 2014 at 6:46 PM, inoyon artlover KLANGRAUSCH 
  wrote: 
 > Great, it works with one form but not with an another... 
 > Btw. how is it possible to overwrite the 'this field is required' 
 error 
 > message? 

 You can provide your custom set of default errors to the form field 
 definition, e.g.: 

 my_default_errors = { 
 'required': 'You better enter this field!', 
 'invalid': 'You can do better than that!' 
 } 

 class MyForm(forms.Form): 
 some_field = forms.CharField(error_messages=my_default_errors) 


 > 
 > Many thanks and best regards! :) 
 > 
 > Am Donnerstag, 4. Dezember 2014 23:01:15 UTC+1 schrieb 
 larry@gmail.com: 
 >> 
 >> On Thu, Dec 4, 2014 at 4:54 PM, inoyon artlover KLANGRAUSCH 
 >>  wrote: 
 >> > Hi there, I got a following Form-Class: 
 >> > 
 >> > 
 >> > class CustomUserprofileInterestsForm(forms.ModelForm): 
 >> > 
 >> > interests = forms.ModelMultipleChoiceField( 
 >> > queryset=Interests.objects.all(), 
 >> > widget=forms.CheckboxSelectMultiple) 
 >> > 
 >> > 
 >> > I want to limit the choices for example to 6 of all displayed. 
 >> > Is it possible with some optional arguments I don't know somehow? 
 >> > 
 >> 
 >> You can write your own clean method on the form, e.g.: 
 >> 
 >> def clean_interests(self): 
 >> value = self.cleaned_data['interests'] 
 >> if len(value) > 6: 
 >> raise forms.ValidationError("You can't select more than 6 
 items.") 
 >> return value 

>>>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d8ceee6-b888-4613-92f5-4783cb2d4e67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in staticfiles' HashedFileMixin?

2014-12-09 Thread Collin Anderson
Hi Bernhard,

Yes, on quick glance this looks like a bug. It looks like all replacements 
get applied to all matching files. Feel free to open a ticket if you 
haven't. (If you have, feel free to link to it in case someone else finds 
this.)

Collin

On Saturday, December 6, 2014 3:29:53 PM UTC-5, Bernhard Mäder wrote:
>
> Hey guys,
>
> HashedFileMixin's pattern variable looks like it could be extended for 
> other file types:
>
> class HashedFilesMixin(object):
> default_template = """url("%s")"""
> patterns = (
> ("*.css", (
> r"""(url\(['"]{0,1}\s*(.*?)["']{0,1}\))""",
> (r"""(@import\s*["']\s*(.*?)["'])""", """@import url("%s")
> """),
> )),
> )
>
>
> But - if I read the code right - it can't. Because in post_process, the 
> patterns are applied to all files matched by any of the extensions. 
>
> What I like to be able to achieve is get cache busting in some of my js 
> files as well. I marked all static file references in my code with a 
> 'staticFile()' call and then tried to customize django's 
> CachedStaticFilesStorage like this:
>
> class MyCachedStaticFilesStorage(django.contrib.staticfiles.storage.
> CachedStaticFilesStorage):
> patterns = django.contrib.staticfiles.storage.HashedFilesMixin.patterns 
> + (
> (u'*.js', [
> (r"""(staticFile\(['"]{0,1}\s*(.*?)["']{0,1}\))""", r
> """staticFile("%s")""", )
> ]),
> )
>
>
> As of today, that won't work, since all CSS rules are applied to my JS, 
> too, which causes some stuff to be replaced that shouldn't.
>
> Is this a bug, and should I file a bug report? Is it worth fixing? How 
> else can I get cache busting into JS files?
>
> Thanks,
> Bernhard
>  
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6688347d-5607-4ed2-a4ff-850429e6a390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-09 Thread Collin Anderson
Hi,

Looking at your traceback, it doesn't look like it's calling your custom 
save() method. Do your current tracebacks show your custom save method?

You could try print(vars(self)) right before saving to see if there is a 
None that shouldn't be there.

Again, if the traceback is happening in the browser, see if you can figure 
out what's in the "params" dict by clicking "local vars".

Collin

On Saturday, December 6, 2014 2:07:00 PM UTC-5, Danish Ali wrote:
>
> No. It also did not work. It was also giving similar error.
>
> On Saturday, December 6, 2014, Collin Anderson  > wrote:
>
>> Hi,
>>
>> Does this work? (What you've already tried, but not using autoslug at 
>> all.)
>>
>> from django.utils.text import slugify
>>
>> slug = models.SlugField(null=True, blank=True)
>> def save(self, *args, **kwargs):
>> self.slug = slugify(self.name or '')
>> super(Shop, self).save(*args, **kwargs)
>>
>> If you have a "pretty" django traceback, you can click to expand where it 
>> says "▶ Local vars".
>>
>> Collin
>>
>>
>> On Friday, December 5, 2014 8:55:06 AM UTC-5, Danish Ali wrote:
>>>
>>> If I remove slug code, then everything works fine. 
>>> And can you tell me how can I expand the variables?
>>>
>>> Thanks 
>>>
>>> On Fri, Dec 5, 2014 at 6:51 PM, Collin Anderson  
>>> wrote:
>>>
 Hi,

 If you remove all the slug code do you still get this error? If so, 
 then the error has nothing to do with automatically creating a slug.

 Try expanding Local vars to see what "params" and "sql are.
 File "e:\python\lib\site-packages\django\db\models\sql\compiler.py" in 
 execute_sql
   920. cursor.execute(sql, params)
 File "e:\python\lib\site-packages\django\db\backends\utils.py" in 
 execute
   85. sql = self.db.ops.last_executed_query(self.cursor, 
 sql, params)

 This does seem like a bug in mysql-connector. You may want to bring it 
 up on the mysql-connector list. http://forums.mysql.com/list.php?50

 You could also try using mysqlclient instead to see if you still have 
 the problem. That's django's recommended connector.
 https://pypi.python.org/pypi/mysqlclient
 https://docs.djangoproject.com/en/dev/ref/databases/#
 mysql-db-api-drivers

 Collin

 On Wednesday, December 3, 2014 3:33:48 PM UTC-5, Danish Ali wrote:
>
> so is there anyway to create slug automatically other than this ?
>
> On Thu, Dec 4, 2014 at 1:29 AM, donarb  wrote:
>
>> On Wednesday, December 3, 2014 11:59:42 AM UTC-8, Danish Ali wrote:
>>>
>>> this is stacktrace when I use: slug = 
>>> AutoSlugField(populate_from='name') 
>>> in my model 
>>>
>>>
>>> Environment:
>>>
>>>
>>> Request Method: POST
>>> Request URL: http://127.0.0.1:8000/admin/product/shop/add/
>>>
>>> Django Version: 1.7.1
>>> Python Version: 3.4.2
>>> Installed Applications:
>>> ('django.contrib.admin',
>>>  'django.contrib.auth',
>>>  'django.contrib.contenttypes',
>>>  'django.contrib.sessions',
>>>  'django.contrib.messages',
>>>  'django.contrib.staticfiles',
>>>  'product')
>>> Installed Middleware:
>>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>>  'django.middleware.common.CommonMiddleware',
>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>>  'django.contrib.messages.middleware.MessageMiddleware',
>>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>>
>>>
>>> Traceback:
>>> File "e:\python\lib\site-packages\django\core\handlers\base.py" in 
>>> get_response
>>>   111. response = wrapped_callback(request, 
>>> *callback_args, **callback_kwargs)
>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py" 
>>> in wrapper
>>>   584. return self.admin_site.admin_view(view)(*args, 
>>> **kwargs)
>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in 
>>> _wrapped_view
>>>   105. response = view_func(request, *args, 
>>> **kwargs)
>>> File "e:\python\lib\site-packages\django\views\decorators\cache.py" 
>>> in _wrapped_view_func
>>>   52. response = view_func(request, *args, **kwargs)
>>> File "e:\python\lib\site-packages\django\contrib\admin\sites.py" in 
>>> inner
>>>   204. return view(request, *args, **kwargs)
>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py" 
>>> in add_view
>>>   1454. return self.changeform_view(request, None, form_url, 
>>> extra_context)
>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in 
>>> _wrapper
>>>   29. return bound_func(*args,

Re: Backup vs Audit

2014-12-09 Thread Lachlan Musicman
Sorry, what I should have lead with is "at the moment there is no
point and click backup solution for your whole package".

On 9 December 2014 at 21:33, Lachlan Musicman  wrote:
> I've used dbbackup with success - a cronjob to copy out the database
> (and replace the testing and staging databases with "yesterday's
> data") and copy it to another machine.
>
> Regards the Django admin interface, there are a number of points to consider:
>  - the base interface will always be in the Django source repository,
> and is well tagged. You should always be able to redeploy from that
>  - any adjustments you have made could be going into another source
> repository (git, mercurial, svn) of your own - which is another backup
> again. If you aren't putting your own changes into a source
> repository, I would suggest that is an excellent start.
>
> FWIW, and I apologise for sounding like a broken record, Danny G and
> Audrey R's Two Scoops of Django is an *excellent* place to start if
> you are comfortable with the tutorial and looking for a "what next"
> text. I found it invaluable for helping with these weird little
> decisions that seem so far from the actual creation of the site you
> are making.
>
> L.
>
> On 9 December 2014 at 21:06, Andrea Zakowicz  wrote:
>> Most of the tools I've found is administered from commands and no template
>> Django admin.
>> What I want is to do  both operations from the manager but found nothing.
>> Help!!
>> For example, proven tools are auditlog and dbbackup.
>>
>>
>>
>>
>> El lunes, 8 de diciembre de 2014 10:22:49 UTC-3, Andrea Zakowicz escribió:
>>>
>>> Hi I wonder if you are aware of how to backup / restoration database and
>>> audit from the django admin.
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5e7524e4-7bed-4459-85ea-57107f5b5778%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You have to be really clever to come up with a genuinely dangerous
> thought. I am disheartened that people can be clever enough to do that
> and not clever enough to do the obvious thing and KEEP THEIR IDIOT
> MOUTHS SHUT about it, because it is much more important to sound
> intelligent when talking to your friends.
> This post was STUPID.
> ---
> The Most Terrifying Thought Experiment of All Time
> http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html



-- 
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
---
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGBeqiPf%3D%3Dz8xCAXw8Bo_733QE-uxw%3DkNrW%2BduQCPPD6fiUKOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Backup vs Audit

2014-12-09 Thread Lachlan Musicman
I've used dbbackup with success - a cronjob to copy out the database
(and replace the testing and staging databases with "yesterday's
data") and copy it to another machine.

Regards the Django admin interface, there are a number of points to consider:
 - the base interface will always be in the Django source repository,
and is well tagged. You should always be able to redeploy from that
 - any adjustments you have made could be going into another source
repository (git, mercurial, svn) of your own - which is another backup
again. If you aren't putting your own changes into a source
repository, I would suggest that is an excellent start.

FWIW, and I apologise for sounding like a broken record, Danny G and
Audrey R's Two Scoops of Django is an *excellent* place to start if
you are comfortable with the tutorial and looking for a "what next"
text. I found it invaluable for helping with these weird little
decisions that seem so far from the actual creation of the site you
are making.

L.

On 9 December 2014 at 21:06, Andrea Zakowicz  wrote:
> Most of the tools I've found is administered from commands and no template
> Django admin.
> What I want is to do  both operations from the manager but found nothing.
> Help!!
> For example, proven tools are auditlog and dbbackup.
>
>
>
>
> El lunes, 8 de diciembre de 2014 10:22:49 UTC-3, Andrea Zakowicz escribió:
>>
>> Hi I wonder if you are aware of how to backup / restoration database and
>> audit from the django admin.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5e7524e4-7bed-4459-85ea-57107f5b5778%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
---
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGBeqiM4vx6VuTU7vYTCtfJQpJV0t7Bth5iNpncjCX6P9owvSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Backup vs Audit

2014-12-09 Thread Tom Evans
On Tue, Dec 9, 2014 at 10:06 AM, Andrea Zakowicz
 wrote:
> Most of the tools I've found is administered from commands and no template
> Django admin.
> What I want is to do  both operations from the manager but found nothing.
> Help!!
> For example, proven tools are auditlog and dbbackup.
>

Off the top of my head there are several reasons why there are few
tools (none that I know of/trust/use) in the DB backup space:

1) good DB management does not happen from a UI, it happens from an
automated system, which will run non interactive commands.
2) For any non trivial database, you aren't going to back it up in the
context of a single request- it should be handled outside the
request-response cycle. This sort of behaviour is not built in to
django - there are good packages that provide it, but why go to the
complexity given the points in 1).

There are plenty of audit trail packages that integrate with django
admin, since audit trails are simply model instances tracking changes
to other model instances. Keywords "django audit".

Cheers

Tom

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2Bkdmxij8%3DqsyA50m67K96U%3D6Srq7teGs%3D12pmZtGGTWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Backup vs Audit

2014-12-09 Thread Andrea Zakowicz
Most of the tools I've found is administered from commands and no template 
Django admin.
What I want is to do  both operations from the manager but found nothing. 
Help!!
For example, proven tools are auditlog and dbbackup.




El lunes, 8 de diciembre de 2014 10:22:49 UTC-3, Andrea Zakowicz escribió:
>
> Hi I wonder if you are aware of how to backup / restoration database and 
> audit from the django admin.
>

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e7524e4-7bed-4459-85ea-57107f5b5778%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner: What are the pitfalls of using an html form without using django forms? I.e. form.py

2014-12-09 Thread Daniel Roseman
On Tuesday, 9 December 2014 01:37:44 UTC, T Kwn wrote:
>
> I'm created a form where a user can add or remove other users from a 
> group. Because the number of available users is unknown beforehand, I 
> needed to create a checkbox form where the number of elements is dynamic. 
> However, I couldn't figure out how to do it so I just used an html form and 
> some . I then processed the result in my view. I do 
> not have any form defined in forms.py.
>
>  I presume this is poor django practice but I'd like to know more details 
> on why. Obviously I'm not getting the built-in form validation but with 
> checkboxes it doesn't seem very necessary. Anything else?
>
> My view can be seen here:
>
> https://gist.github.com/anonymous/d1e8bd43c20eced9e4ce
>
> The template code is pretty basic such as:
>
> {% for myuser in members %}
> {{ myuser.username }}
> 
> 
> {% endfor %}
>
>
>
There's nothing wrong with doing that, of course. Just as you can write raw 
SQL to talk to your database, and even raw WSGI to power your web app. But 
Django provides utilities like the ORM, and the forms framework, to make it 
easier for you. If you find they don't help for your use case, then feel 
free not to use them.
--
DR.

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/206cfa0f-cdf8-4d44-827c-c703e298d782%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django ModelForm: error name 'self' is not defined

2014-12-09 Thread Daniel Roseman
On Tuesday, 9 December 2014 06:17:57 UTC, JAI PRAKASH SINGH wrote:
>
> hello all, 
>
>
> I am trying to make a registration form using User model so  i am using 
> ModelForm 
>
> as I am using bootstrap template i need to add some atribute like class 
> placeholder 
>
> so i am using widget, am facing a problem , i searchd a lot but unable to 
> find the solution 
>
> please help 
>
> my code is under 
>
>
> 
>
> error :- name 'self' is not defined
> on borwser 
>
> ##3
>
> forms.py 
>
>
> class RegistrationForm(ModelForm):
>
> class Meta:
> model = User
> fields = [ 'username', 'password', 'email' ]
>
> def __init__(self, *args, **kwargs): 
> super(RegistrationForm, self).__init__(*args, **kwargs)
>
> self.fields['username'].widget = forms.TextInput(attrs={"placeholder" 
> : "First Name", 
> "name" : "first_name"})
>
> self.fields['email'].widget = forms.TextInput(attrs={"placeholder" : 
> "Email Address", 
> "name" : "email"})
>
> self.fields['password'].widget = forms.PasswordInput(attrs={
> "placeholder" : "Password", "name" : "password", "class" : 
> "form-control input-sm"})
>

Make sure the last line is indented to the same level as the others. 
--
DR.

-- 
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 django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8616ab41-e72b-47b4-a82a-4c683d9cec4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.