Re: NAS using Django

2016-03-10 Thread reduxionist
On Wednesday, March 9, 2016 at 7:15:17 PM UTC+7, Vayuj Rajan wrote:
>
> Hi,
> I have a query whether we can implement NAS (network attached storage) 
> functionality using Django framework?
>

FWIW FreeNAS  uses Django for its web admin (at 
least it did last time I installed it).

Best wishes,
Jonathan 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25ec850a-d259-4a06-8579-6addff9de2a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Absolute beginner, missing icons on admin page

2016-03-10 Thread David Hou
I'm just working through the tutorials right now and noticed that my admin 
page is missing some of the icons (add, change, calender) that are in the 
tutorial.  Looking through the HTML, these icons don't even seem to exist. 
 Am I doing something wrong?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1f52991-48a1-467c-bcfd-7f5076c83736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model or Form class

2016-03-10 Thread Bob Gailer
On Mar 10, 2016 9:01 PM, "Denis Makarov"  wrote:
>
> Hello guys! In whitch cases need to use models.Model class  and in whitch
forms.Form?

Models define tables in a database. Forms assist in creating HTML forms for
gathering, valididating and saving user input. Does that help?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP1rxO5zTA0V-eYG%2Bf-yfu2OqB24dDHX3Dk5hJYHx56z_rdGEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Model or Form class

2016-03-10 Thread Denis Makarov
Hello guys! In whitch cases need to use models.Model class  and in whitch 
forms.Form?

Don't understand it readed the documentation. 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5672d6ed-67dc-46bf-9d82-66cb0ecb31b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to parse connection string: "" when using django cache

2016-03-10 Thread Nandakumar Chandrasekhar
Sorry forgot to add the traceback I am getting:

Internal Server Error: /
Traceback (most recent call last):
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/handlers/base.py",
line 88, in get_response
response = middleware_method(request)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/middleware/cache.py",
line 147, in process_request
cache_key = get_cache_key(request, self.key_prefix, 'GET',
cache=self.cache)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/utils/cache.py",
line 212, in get_cache_key
headerlist = cache.get(cache_key, None)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/cache/backends/memcached.py",
line 75, in get
val = self._cache.get(key)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/cache/backends/memcached.py",
line 163, in _cache
self._client = self._lib.Client(self._servers,
pickleProtocol=pickle.HIGHEST_PROTOCOL)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 223, in __init__
self.set_servers(servers)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 302, in set_servers
for s in servers]
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 1317, in __init__
raise ValueError('Unable to parse connection string: "%s"' % host)
ValueError: Unable to parse connection string: ""

Exception happened during processing of request from ('127.0.0.1', 52825)

[11/Mar/2016 00:59:39] "GET / HTTP/1.1" 500 118134
Traceback (most recent call last):
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
line 86, in run
self.finish_response()
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
line 131, in finish_response
self.close()
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/simple_server.py",
line 36, in close
SimpleHandler.close(self)
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
line 259, in close
self.result.close()
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/http/response.py",
line 305, in close
signals.request_finished.send(sender=self._handler_class)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
line 185, in send
response = receiver(signal=self, sender=sender, **named)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/cache/backends/memcached.py",
line 100, in close
self._cache.disconnect_all()
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/cache/backends/memcached.py",
line 163, in _cache
self._client = self._lib.Client(self._servers,
pickleProtocol=pickle.HIGHEST_PROTOCOL)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 223, in __init__
self.set_servers(servers)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 302, in set_servers
for s in servers]
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/memcache.py",
line 1317, in __init__
raise ValueError('Unable to parse connection string: "%s"' % host)
ValueError: Unable to parse connection string: ""
[11/Mar/2016 00:59:39] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
line 599, in process_request_thread
self.finish_request(request, client_address)
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File
"/Users/nchandrasekhar/PycharmProjects/horizon/.venv/lib/python2.7/site-packages/django/core/servers/basehttp.py",
line 126, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
line 655, in __init__
self.handle()
  File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/simple_server.py",
line 131, in handle
handler.run(self.server.get_app())
  File

Installing Django and Running with Canopy

2016-03-10 Thread jda0017
Hello All, I am new to this group but I need some help installing and 
running Django on a mac. I prefer to use Enthought's Canopy as my Python 
environment. Can anyone help me out with this?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5b5ec24-e8af-45fd-87ba-fbb6e3d5f425%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unable to parse connection string: "" when using django cache

2016-03-10 Thread nav
Hi,

I am configuring the memcache backend to use with django and have the 
following things setup:

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}

CACHE_MIDDLEWARE_ALIAS = 'django.core.cache.backends.memcached.MemcachedCache'
CACHE_MIDDLEWARE_SECONDS = 3 * 60 * 60 # 3 hours in seconds
CACHE_MIDDLEWARE_KEY_PREFIX = ''


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
# the order of our middleware matters!
# should be later than AuthenticationMiddleware,
# but earlier than HorizonMiddleware
'horizon.middleware.HorizonMiddleware',
)


I keep hitting the error message "Unable to parse connection string: "" which 
is coming from the memcache.py from the python-memcached binding. This is 
because the tuple of cache servers is empty instead of containing 
127.0.0.1:11211.


I have verified that the memcache daemon is up and running and have added and 
retrieved data from it.


Hence, I believe that there is something wrong with my configuration and I have 
been trying to figure out what is wrong for hours. I hope someone can lend some 
assistance.


Many thanks,

nav

P.S. This is the first time I am setting up a cache so I may need some 
explanation of some concepts.


 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2131332e-33cf-4d73-a9b7-2107bf07b2c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Development of web based image processing package

2016-03-10 Thread Mario R. Osorio
I know nothing about the subject, but I stumbled upon this article I think 
might be useful in your endeavor:

Fundamentals of Image Processing - behind the scenes 



On Thursday, March 3, 2016 at 12:47:56 PM UTC-5, Neha Chhattani wrote:
>
> hello
> i want to create a website that will do image processing in real time. i 
> want to load large tiff images i.e. images used in remote sensing and 
> satellite images. I want to do processing on satellite images. is it 
> possible to do this processing in website using django? If yes, how to 
> start with? what are the requirements for this? 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1fe1e6ac-ddee-4f24-9eea-4ba1b93e1f82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Odd behaviour of DjangoJSONSerializer when serializing datetimes with/without microseconds

2016-03-10 Thread Simon Charette
It looks like I talked to fast.

The microseconds are explicitly stripped because the string format used is 
based on ECMA-262:

http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15

>From what I understand JavaScript dates are limited to millisecond 
precision.

Simon

Le jeudi 10 mars 2016 12:12:25 UTC-5, Simon Charette a écrit :
>
> Hi Rob,
>
> The fact DjangoJSONEncoder strips microseconds is definitely a bug that 
> should
> be reported:
>
> > e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
> second=1, microsecond=123456))
> > '2016-01-01T01:01:01.123'
>
> I think always including the microseconds could make sense but I'm not 
> sure it's
> worth it in regard to backward incompatiblity. Keep in mind that Django 
> relies
> on the `datetime.datetime.isoformat` stdlib method which does the stripping
> internally:
>
> > datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
> second=1).isoformat()
> > '2016-01-01T01:01:01'
>
> Cheers,
> Simon
>
> > e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
> second=1, microsecond=123456))
> > '2016-01-01T01:01:01.123'
>
> I think always including the microseconds could make sense but since it 
> might have backward compatibility 
>
> Le jeudi 10 mars 2016 07:52:49 UTC-5, Robert Kirberich a écrit :
>>
>> Hi,
>>
>> I stumbled across this yesterday while trying to figure out why some of 
>> my tests would sometimes fail when serializing and deserializing datetimes 
>> to JSON.
>>
>> DjangoJSONSerializer only includes the milliseconds in the encoded string 
>> if the original datetime has a non-zero microsecond value - this is fine 
>> when only dealing with the JSON in Javascript, but in python it requires 
>> two different cases when decoding.
>>
>> To make things even more confusing, the milliseconds field can be 
>> included even if it's zero:
>>
>> import datetime
>> from django.core.serializers.json import DjangoJSONEncoder
>> e = DjangoJSONEncoder()
>>
>> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
>> second=1, microsecond=1))
>> '2016-01-01T01:01:01.000'
>>
>> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
>> second=1, microsecond=0))
>> '2016-01-01T01:01:01'
>>
>>
>>
>> This seems like a bug to me (easily fixed by always including the 
>> milliseconds), but I wanted to check first if there's a reason for this 
>> behaviour, as that code has been there for ages. If this is a bug, I'll be 
>> happy to send a PR.
>>
>>
>> Cheers
>> Rob
>>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5c6f98f-d0e7-423a-a2e4-f956841d887f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Odd behaviour of DjangoJSONSerializer when serializing datetimes with/without microseconds

2016-03-10 Thread Simon Charette
Hi Rob,

The fact DjangoJSONEncoder strips microseconds is definitely a bug that 
should
be reported:

> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
second=1, microsecond=123456))
> '2016-01-01T01:01:01.123'

I think always including the microseconds could make sense but I'm not sure 
it's
worth it in regard to backward incompatiblity. Keep in mind that Django 
relies
on the `datetime.datetime.isoformat` stdlib method which does the stripping
internally:

> datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
second=1).isoformat()
> '2016-01-01T01:01:01'

Cheers,
Simon

> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
second=1, microsecond=123456))
> '2016-01-01T01:01:01.123'

I think always including the microseconds could make sense but since it 
might have backward compatibility 

Le jeudi 10 mars 2016 07:52:49 UTC-5, Robert Kirberich a écrit :
>
> Hi,
>
> I stumbled across this yesterday while trying to figure out why some of my 
> tests would sometimes fail when serializing and deserializing datetimes to 
> JSON.
>
> DjangoJSONSerializer only includes the milliseconds in the encoded string 
> if the original datetime has a non-zero microsecond value - this is fine 
> when only dealing with the JSON in Javascript, but in python it requires 
> two different cases when decoding.
>
> To make things even more confusing, the milliseconds field can be included 
> even if it's zero:
>
> import datetime
> from django.core.serializers.json import DjangoJSONEncoder
> e = DjangoJSONEncoder()
>
> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
> second=1, microsecond=1))
> '2016-01-01T01:01:01.000'
>
> e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
> second=1, microsecond=0))
> '2016-01-01T01:01:01'
>
>
>
> This seems like a bug to me (easily fixed by always including the 
> milliseconds), but I wanted to check first if there's a reason for this 
> behaviour, as that code has been there for ages. If this is a bug, I'll be 
> happy to send a PR.
>
>
> Cheers
> Rob
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a9557eb-55aa-4a94-a578-58603956b4d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best bootstrap plugins-addons in django-bootstrap project?

2016-03-10 Thread Горобец Дмитрий
http://bootstraptour.com/

четверг, 10 марта 2016 г., 17:57:34 UTC+5 пользователь setivo...@gmail.com 
написал:
>
> I found useful bootstrap-datetimepicker, may be someone known yet?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8ef892b7-96a7-4a9a-a057-1b83f73f7296%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NAS using Django

2016-03-10 Thread Aaron C. de Bruyn
Take a look at FreeNAS.  They are running FreeBSD with a Django front-end
that configures (among other things) Samba shares and Samba AD/domain joins.

-A

On Wed, Mar 9, 2016 at 11:03 PM, Vayuj Rajan  wrote:

> Actually, I saw a NAS at my friends place so I came up with an idea a of
> creating my own using a raspberry pi and an extrernal HDD.
> I configured SAMBA and I can access it directly at my computer. But what I
> saw there that he was accessing it by using a  website . So basically he
> was accessing it from local web server with a storage attached.
>
> So, I wanted to connect my Django web application with Samba File sharing
> sever so that I can access it from an IP typed at a web-browser.
>
> On Wed, Mar 9, 2016 at 10:03 PM, Aaron C. de Bruyn 
> wrote:
>
>> That's still pretty vague.  What 'file sharing protocols' are you talking
>> about specifically?  And what do you mean by wanting to 'connect' the file
>> sharing protocols to the application?
>>
>> There is a PySMB library that will allow your Django application to
>> pretend to be a Windows client.
>>
>> If you're just talking about having the Django application display
>> existing files/mounts, there are various built-in tools for that.
>>
>> You might want to take a look at the FreeNAS project.  They have a Django
>> application running as a front-end to their FreeNAS appliance.
>>
>> -A
>>
>> On Wed, Mar 9, 2016 at 4:50 AM, Vayuj Rajan  wrote:
>>
>>> What I wanted to do is to connect the file sharing protocols to this web
>>> application i.e the one I will be making it from Django and I wanted to
>>> host this application using apache so that it can be hosted locally.
>>>
>>> On Wednesday, March 9, 2016 at 6:05:51 PM UTC+5:30, Andréas Kühne wrote:

 Hi Vayuj,

 I think you have to be a bit more specific. Django is a web framework,
 used for creating web applications and websites. A NAS is usually an array
 of harddrives that has different file sharing protocols attached (for
 example SMB or NFS).

 It would be possible to implement something like Amazons S3 in django
 however if that is what you want?

 Regards,

 Andréas

 2016-03-09 12:09 GMT+01:00 Vayuj Rajan :

> Hi,
> I have a query whether we can implement NAS (network attached storage)
> functionality using Django framework?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9a9914d7-37cf-4608-892a-2f0a08b001a1%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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/fe72a195-2815-42ef-867c-6245d9e62d1c%40googlegroups.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/E2loEnbFSAs/unsubscribe.
>> To unsubscribe from this group and all its topics, 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEE%2BrGpsfTR_SH2jJk%2B3F3PxNLAmvgQYsd%3D9a4FHFSpJu3xvbw%40mail.gmail.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 

Re: partial database restoration

2016-03-10 Thread Bill Freeman
That's a good question.  I'd rather write it in python, but if it runs
daily on non-trivial tables, I suspect that performance is better with a
script that gets the DB to produce the dump files, maybe onto a NAS.  The
restore part should be a lot less frequent, so performance is probably less
important.  You may have to clean up old DB content for that user before
the restore.  So I might write the restore in python.  But then, I've never
written DB PL, so I could be missing a bet.

On Thu, Mar 10, 2016 at 12:15 AM, Mike Dewhirst 
wrote:

> On 10/03/2016 11:15 AM, Bill Freeman wrote:
>
>> The only problem I can think of with a DB script is that it may have to
>> be recoded at unpleasant times, such as when you run a migration to take
>> a new version with a security fix.
>>
>> If you are going to do it in Django, it would be by saving stuff out to
>> a fixture, maybe with a custom management command, and that still
>> suffers from the need to re-write at schema changes.
>>
>
> If you were going to do it, which approach would you take?
>
> Thanks Bill
>
> M
>
>
>> On Wed, Mar 9, 2016 at 6:24 PM, Mike Dewhirst > > wrote:
>>
>> I have a Django project oriented around lots of companies and each
>> company enters its own data. I need to produce a separate individual
>> database backup or dump for each company.
>>
>> It will be used on request to perform an individual restoration
>> after user error has damaged a company's data.
>>
>> I presume this is a Postgres scripting task or is there a Django
>> recipe?
>>
>> Thanks for any pointers
>>
>> Mike
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>>
>> https://groups.google.com/d/msgid/django-users/56E0B0A1.6000809%40dewhirst.com.au
>> .
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>>
>> https://groups.google.com/d/msgid/django-users/CAB%2BAj0szPfR5KZM32R6EePgf%3D9B4gw-gnty2-yNO2O7AWCZG7Q%40mail.gmail.com
>> <
>> https://groups.google.com/d/msgid/django-users/CAB%2BAj0szPfR5KZM32R6EePgf%3D9B4gw-gnty2-yNO2O7AWCZG7Q%40mail.gmail.com?utm_medium=email_source=footer
>> >.
>> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/56E102FF.1020302%40dewhirst.com.au
> .
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0vjVnA8Fmr%3DgvkEff7o%2ByTA8Ng95BA7Pss3vYcA8pQRAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NAS using Django

2016-03-10 Thread Vayuj Rajan
yes you can say in that way I wanted to create a Owncloud for local server

On Thu, Mar 10, 2016 at 3:24 PM, Florian Schweikert 
wrote:

> On 10/03/16 08:03, Vayuj Rajan wrote:
> > I configured SAMBA and I can access it directly at my computer. But what
> > I saw there that he was accessing it by using a  website . So basically
> > he was accessing it from local web server with a storage attached.
>
> You basically want something like owncloud[1] if I get you right.
>
> > So, I wanted to connect my Django web application with Samba File
> > sharing sever so that I can access it from an IP typed at a web-browser.
>
> If Django running on the NAS, there is no need to use smb.
>
> --
> Florian
>
> [1] https://owncloud.org/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/E2loEnbFSAs/unsubscribe.
> To unsubscribe from this group and all its topics, 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/56E14438.1030102%40ist-total.org
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABe4X67nQKyq0SJj9UpGrL6_cPnGPfdSma36Fd_ibuxeV9fgiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Best bootstrap plugins-addons in django-bootstrap project?

2016-03-10 Thread setivolkylany
I found useful bootstrap-datetimepicker, may be someone known yet?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/100d7021-e391-4147-98a7-2e574bb2fc09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I can not create a new user via admin Django?

2016-03-10 Thread setivolkylany

I create project with my authuser model where login via email, not through 
name



Models.py



import imghdr
import string
import datetime

from django_countries.fields import CountryField

from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, 
PermissionsMixin
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.core.validators import MinLengthValidator
from django.conf import settings

from libs.validators import OnlyLowercaseAndDigits


ALLOWED_CHARS = string.ascii_lowercase + string.digits
MAX_LENGTH = 8


class AccountUserManager(BaseUserManager):
"""
Manager for my user model
"""

def create_user(self, email, name, password=None):
"""
Creates and saves a user with the given email, name of account and 
password.
"""
if not email:
raise ValueError('User must have an email address')
if not name:
raise ValueError('User must have a name of account')
user = self.model(email=self.normalize_email(email), name=name)
user.set_password(password)
user.save()
return user

def create_superuser(self, email, name, password):
"""
Creates and saves a superuser with the given email, name of account 
and password.
"""
if not password:
raise ValueError('Superuser must be have a password')
user = self.create_user(email=self.normalize_email(email), 
name=name, password=password)
user.is_superuser = True
user.save()
return user

def make_random_password(self, length=10, allowed_chars=ALLOWED_CHARS):
return super().make_random_password(length, allowed_chars)


class AccountUser(AbstractBaseUser, PermissionsMixin):
"""
Model for users, registering by email and unique name of account
"""

email = models.EmailField('Email of account', max_length=50, 
unique=True)
name = models.CharField('Account of name', max_length=50, validators=[
OnlyLowercaseAndDigits,
MinLengthValidator(MAX_LENGTH, 'Field must be at least {0} 
chars'.format(MAX_LENGTH)),
])
is_active = models.BooleanField(default=True)
date_joined = models.DateTimeField('Date joined', auto_now_add=True)

objects = AccountUserManager()

USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['name']

class Meta:
db_table = 'account_user'
verbose_name = "AccountUser"
verbose_name_plural = "AccountUsers"
get_latest_by = 'date_joined'
ordering = ['-date_joined']

def __str__(self):
return '{0.email}'.format(self)

def save(self, *args, **kwargs):
try:
self.full_clean()
except ValidationError as errors_message:
print('Was happened next 
errors:\n-')
for error in errors_message:
print(error)
else:
super().save(*args, **kwargs)
account = AccountUser.objects.get(email=self.email)
if not hasattr(account, 'accountuserinfo'):
AccountUserInfo.objects.create(account=account)

def get_absolute_url(self):
return reverse('app_accounts:account_profile')

def get_full_name(self):
return '{0.name} ({0.email})'.format(self)

def clean(self):
if len(self.password) < MAX_LENGTH:
raise ValidationError({
'password': 'Length of password must be at least 
{0}'.format(MAX_LENGTH)
})
if all(i in string.digits for i in self.password):
raise ValidationError({
'password': 'Your password can\'t be entirely numeric'
})

def get_short_name(self):
return '{0.email}'.format(self)

@property
def is_staff(self):
return self.is_superuser

def all_dictionaries_created_user(self):
count_translators = self.translators.count()
count_glossaries = self.glossaries.count()
if any([count_translators, count_glossaries]):
result = 'User have: translators - {0}; glossaries - 
{1}.'.format(count_translators, count_glossaries)
else:
result = 'User have not nothing!!!'
return result

def last_created_dictionaries(self, types_dictionaries=['translators', 
'glossaries']):
result = list()
for type_dictionary in types_dictionaries:
if type_dictionary == 'translators':
created_translators = self.translators.all()[:3]
if created_translators:
result.append('User have next translators: 
{0}'.format(created_translators))
else:
result.append('User have not translators')
if type_dictionary == 'glossaries':
created_glossaries = self.glossaries.all()[:3]

Odd behaviour of DjangoJSONSerializer when serializing datetimes with/without microseconds

2016-03-10 Thread 'Robert Kirberich' via Django users
Hi,

I stumbled across this yesterday while trying to figure out why some of my 
tests would sometimes fail when serializing and deserializing datetimes to 
JSON.

DjangoJSONSerializer only includes the milliseconds in the encoded string 
if the original datetime has a non-zero microsecond value - this is fine 
when only dealing with the JSON in Javascript, but in python it requires 
two different cases when decoding.

To make things even more confusing, the milliseconds field can be included 
even if it's zero:

import datetime
from django.core.serializers.json import DjangoJSONEncoder
e = DjangoJSONEncoder()

e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
second=1, microsecond=1))
'2016-01-01T01:01:01.000'

e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, 
second=1, microsecond=0))
'2016-01-01T01:01:01'



This seems like a bug to me (easily fixed by always including the 
milliseconds), but I wanted to check first if there's a reason for this 
behaviour, as that code has been there for ages. If this is a bug, I'll be 
happy to send a PR.


Cheers
Rob

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c0fcf06a-10ac-4255-950a-462d26595c6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best jquery plugins in django-bootstrap project?

2016-03-10 Thread setivolkylany
I found useful ajaxform.js, moment.js, jcrop.js may be someone known yet?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a9caebba-d527-47d2-833c-b9d990545762%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best plungin bootstrap for django+bootstrap project?

2016-03-10 Thread setivolkylany
I found useful bootstrap-datetimepicker, may be is yet?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7657b265-992b-47a8-a02a-a3acd4650afe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Both directly transfer data from django to jQuery

2016-03-10 Thread setivolkylany
May be there is something simpler than Ajax request?


четверг, 10 марта 2016 г., 14:20:17 UTC+2 пользователь Sergiy Khohlov 
написал:
>
> Ajax ?
>  Have you checked this one ?  
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Thu, Mar 10, 2016 at 2:18 PM,  
> wrote:
>
>> I had method model that generate dict, sample:
>>
>> {
>> 'translators': 5,
>> 'glossaries': 1,
>> 'abbrs': 0,
>> }
>>
>> I want known, how transfer data without hidden fields in html file. I 
>> need here for generate google-chart.
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/1cc9d0cd-b6d1-46dc-9c7a-092e7422464e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7aa0c3b1-fd47-4c07-8ac5-9b3072120750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Where it makes sense to use other methods in addition to POST and Get, for example HEAD?

2016-03-10 Thread setivolkylany
just wondering

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8fe563f9-49b5-41ae-968d-43aaa919e508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Both directly transfer data from django to jQuery

2016-03-10 Thread Sergiy Khohlov
Ajax ?
 Have you checked this one ?

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Thu, Mar 10, 2016 at 2:18 PM,  wrote:

> I had method model that generate dict, sample:
>
> {
> 'translators': 5,
> 'glossaries': 1,
> 'abbrs': 0,
> }
>
> I want known, how transfer data without hidden fields in html file. I need
> here for generate google-chart.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1cc9d0cd-b6d1-46dc-9c7a-092e7422464e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJOSjnfqrg1UAj-WjO4Af%3D9-4bjj9UO1LzeOmpmfL0tq6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Both directly transfer data from django to jQuery

2016-03-10 Thread setivolkylany
I had method model that generate dict, sample:

{
'translators': 5,
'glossaries': 1,
'abbrs': 0,
}

I want known, how transfer data without hidden fields in html file. I need 
here for generate google-chart.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1cc9d0cd-b6d1-46dc-9c7a-092e7422464e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best solution for processing uploaded video/audio files from user?

2016-03-10 Thread setivolkylany
Diffrent browser supported different types of video/audio files.

Opera supports - only .ogg/ogv
Firefox - only mp3/mp4
Chrome - both that and another 

How to choice best solution for saved uploaded files from user in Django 
project?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b8b2497-b840-484b-8c98-6580610a16cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NAS using Django

2016-03-10 Thread Florian Schweikert
On 10/03/16 08:03, Vayuj Rajan wrote:
> I configured SAMBA and I can access it directly at my computer. But what
> I saw there that he was accessing it by using a  website . So basically
> he was accessing it from local web server with a storage attached.

You basically want something like owncloud[1] if I get you right.

> So, I wanted to connect my Django web application with Samba File
> sharing sever so that I can access it from an IP typed at a web-browser.

If Django running on the NAS, there is no need to use smb.

--
Florian

[1] https://owncloud.org/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56E14438.1030102%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature