Re: Drawback of delete all migrations file

2016-12-09 Thread Sylvain Dégué
NVM i read loaddata documentation

Le vendredi 9 décembre 2016 19:49:50 UTC-5, Sylvain Dégué a écrit :
>
> Thanks guy!!But how do I reload the my previous data to the new database 
> if the model changed??
>
> Le vendredi 9 décembre 2016 13:39:50 UTC-5, Sylvain Dégué a écrit :
>>
>> Im about to lauch a project that uses django for the api. So im only 
>> using the admin side for now. Ive been having problem concerning the 
>> database and forms.
>> Ive made many mistake while updating the database, when certain field 
>> didnt allow null. It caused IntegrityError, which I was able to fix
>>
>> SO im thinking about reset completly my production database and remove 
>> all the migrations to start fresh. I dont have much data in the production 
>> database so its probably the best time.
>>
>>
>> Is there any drawback to flushing the database and removing the 
>> migrations files 
>>
>

-- 
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/41d52cbe-abbb-4e39-8d2c-14331178449c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Drawback of delete all migrations file

2016-12-09 Thread Sylvain Dégué
Thanks guy!!But how do I reload the my previous data to the new database if 
the model changed??

Le vendredi 9 décembre 2016 13:39:50 UTC-5, Sylvain Dégué a écrit :
>
> Im about to lauch a project that uses django for the api. So im only using 
> the admin side for now. Ive been having problem concerning the database and 
> forms.
> Ive made many mistake while updating the database, when certain field 
> didnt allow null. It caused IntegrityError, which I was able to fix
>
> SO im thinking about reset completly my production database and remove all 
> the migrations to start fresh. I dont have much data in the production 
> database so its probably the best time.
>
>
> Is there any drawback to flushing the database and removing the migrations 
> files 
>

-- 
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/5fcc9af4-f9b6-44e9-9121-01f81c8f73c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django - How to have multiple (4) distinct forms in CBV

2016-12-09 Thread Leo Shao


I need 4 forms to: sign up for an event (1), un-sign up for an event (2), 
type in a passcode to manage an event (3) which then shows a modal box that 
allows that person to check in everyone that shows up at the event (4). I'm 
using a (ListView, FormView) to allow looping through the numerous events, 
each of which has a form on it (but it's the same class of form that's used 
for signing up).

My current CBV:

class EventsDisplay(ListView, FormView):
template_name='events/index.html'
context_object_name = "events_list"
queryset = Events.objects.all().order_by("date")
form_class = SignUpForm
success_url = "/events/success"

def get_context_data(self, **kwargs):
self.object_list = self.get_queryset()
context = super(EventsDisplay, self).get_context_data(**kwargs)
context['announcement'] = 
Announcement.objects.all().order_by("-datetime")
context['signup'] = SignUps.objects.all().order_by("fullname")
return context

def form_valid(self, form):
instance = form.save(commit=False)
instance.ip = get_ip(self.request)
instance.save()
return super(EventsDisplay, self).form_valid(form)

How would I modify this to support up to 4 different classes of forms.


I'll provided screenshots of my website to better clarify what I want to do:

All the events are displayed on one page, each event has a sign up form 
(with a hidden input containing the {{ events.name }}: 
https://i.gyazo.com/d8da1b0aefb9093b6b63a7f2da0bf428.png

Clicking on OCC Check-Ins, a modal shows up where a passcode is needed to 
access the check-ins: 
https://i.gyazo.com/998330055f27feedb12491d6fd0ac60c.png

Not yet made, but after the passcode is validated for the given event, 
another modal appears where the person can check in people at the event, so 
I'll need a form there.

Clicking on the down arrow brings up a modal that allows users to remove 
themselves (unsign up): 
https://i.gyazo.com/71c8598f77f79643e3b10a8dd67a733d.png I'm using a form 
to POST the {{ events.name }} (hidden input) and the {{ signups.fullname}} 
(hidden 
input) to .delete() the sign up/object.


If it's not possible to do this, will it work if I only have 2 distinct 
forms?

If you would like any additional information/code/clarification, I will 
gladly post them.

-- 
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/11378ba0-7beb-44d8-8dfd-fc2cf14096a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Matching query does not exist when retrieving object by slug

2016-12-09 Thread Viet Phuong
(My English is not so good so I'll just try to be simple, sorry guys)

So I have a model TopList which has a slug field so I can look up its 
object by slug.

class TopList(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=200, default='')

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.set_slug()

def save(self, *args, **kwargs):
super().save(*args, **kwargs)
self.set_slug()

def set_slug(self):
self.slug = slugify(self.name, allow_unicode=True)

The problem is when I use a ModelForm to create object, the slug field is 
set correctly, but when I use it to look up the object, it returns 
"lists.models.DoesNotExist: TopList matching query does not exist" (I tried 
it in the shell):

# forms.py
class TopListForm(ModelForm):
class Meta:
model = TopList
fields = ('name',)

# Item is just a model which has foreignkey relationship with TopList
ItemFormSet = inlineformset_factory(TopList, Item, fields=('name',))

# views.py
def new_list(request):
form = TopListForm()
item_formset = ItemFormSet()

if request.method == 'POST':
form = TopListForm(request.POST)
if form.is_valid():
created_list = form.save(commit=False)
item_formset = ItemFormSet(request.POST, instance=created_list)
if item_formset.is_valid():
created_list.save()
item_formset.save()
return redirect('/danh-sach')

return render(request, 'lists/new_list.html', context={'form': form, 
'item_formset': item_formset})

But if I use TopList.objects.create(name='something') to create object, 
slug is still set correctly, and I can retrieve it by slug.

# "test test" is an object I created earlier using form
>>> TopList.object.get(slug='test-test')
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'TopList' has no attribute 'object'
>>> TopList.objects.get(slug='test-test')
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/vietphuong/Documents/Python/toptenproject/venv/lib/python3.5/site-packages/django/db/models/manager.py"
, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
  File 
"/home/vietphuong/Documents/Python/toptenproject/venv/lib/python3.5/site-packages/django/db/models/query.py"
, line 385, in get
self.model._meta.object_name
lists.models.DoesNotExist: TopList matching query does not exist.
>>> TopList.objects.create(name='another test')

>>> TopList.objects.get(slug='another-test')



Another thing is after I try to save that "test test" object, just save no 
changing at all, I can now look it up.

>>> TopList.objects.get(name='test test')

>>> t = TopList.objects.get(name='test test')
>>> t.slug
'test-test'
>>> t.save()
>>> TopList.objects.get(slug='test-test')


-- 
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/d72c1256-5b10-4d49-b0a1-a4bed16151db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help Needed: Django Server For High Frequent Requests

2016-12-09 Thread Xiao Bo


I'm building a Django server for data collection. However, the program 
seems not capable when the sensing network expands. As time goes on, the 
program doesn't even enter the code piece and report broken pipe/connection 
reset by peer/too many open files errors:

Exception happened during processing of request from ('172.58.139.243', 
30713)Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
  File "/usr/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 
126, in __init__
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
  File "/usr/lib/python2.7/socket.py", line 279, in close
  File "/usr/lib/python2.7/socket.py", line 303, in flush
error: [Errno 32] Broken pipe
[08/Dec/2016 17:46:47] "POST /Update_Data/ HTTP/1.1" 500 39484Traceback (most 
recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 217, in write
  File "/usr/lib/python2.7/socket.py", line 324, in write
  File "/usr/lib/python2.7/socket.py", line 303, in flush
error: [Errno 104] Connection reset by peer
File "/usr/lib/python2.7/random.py", line 810, in randomOSError: [Errno 24] Too 
many open files

I checked the open files and it seems like the socket files are never 
closed. The list is full of items like the followings:

python30404 30522 ubuntu  732u IPv4 2437194784  0t0TCP 
192.168.100.2:9003->172.58.137.113:18538 (ESTABLISHED)
python30404 30522 ubuntu  733u IPv4 2437194788  0t0TCP 
192.168.100.2:9003->172.58.137.113:55661 (ESTABLISHED)
python30404 30522 ubuntu  734u IPv4 2437194792  0t0TCP 
192.168.100.2:9003->172.58.137.113:42461 (ESTABLISHED)
python30404 30522 ubuntu  735u IPv4 2437194793  0t0TCP 
192.168.100.2:9003->172.58.137.113:40438 (ESTABLISHED)
python30404 30522 ubuntu  736u IPv4 2437194797  0t0TCP 
192.168.100.2:9003->172.58.137.113:52998 (ESTABLISHED)

Any ideas? Let me know if you need any further information.

-- 
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/58e4d24e-ca9b-41da-8df7-3e195630b05a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Where to store simple texts

2016-12-09 Thread Nikolay Steblin-Kamenskiy
I have created a simple page a sort of announcement and I doubt that I put 
my text smart enogh. Would love to hear comment of more experienced users. 
Where are several blocks of text. One of it I've put directly into html 
template (using "p" tag for each line). For another one (a list) I have 
created a django module as I wanted to do 'for loop' in the template for 
each paragraph. But some of this paragraph I've slightly changed in the 
html template again using (if instance.id == ) clause. 

It's quite painful now to update those texts as they are stored in 
different places. What would you do? Could I create a couple of .txt files 
and retrieve texts from them? 

-- 
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/5ce120b4-9b06-4c0e-a50d-e836a8e16244%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error with Tutorial - Writing your first Django app, part 1

2016-12-09 Thread Fabio C. Barrionuevo da Luz
Missing comma on you urlpatterns


urlpatterns = [
url(r'^polls/', include('polls.urls'))* ,*
url(r'^admin/', admin.site.urls),
]




On Fri, Dec 9, 2016 at 4:10 PM, shah  wrote:

> Hi, I am facing the same issue with the tutorial.
>
> I have got my program correct. But after running the sever. It shows an
> error on chrome.
>
> Page not found (404)
> Request Method: GET
> Request URL: http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>
> The current URL, polls/, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> Since this is first ste of tutorial. I am not able to move forward. Thanx
> for rely in advance.
>
> On Tuesday, 11 October 2016 02:12:30 UTC+5:30, Johnny McClung wrote:
>>
>> I am getting an error when I try to run the Django server.
>>
>> >> mysite >> polls >> urls.py
>> from django.conf.urls import url
>>
>>
>> from . import views
>>
>> urlpatters = [
>> url(r'^$', views.index, name='index'),
>> ]
>>
>>
>>
>>
>> >> mysite >> mysite >> urls.py
>> from django.conf.urls import include, url
>> from django.contrib import admin
>>
>> urlpatterns = [
>> url(r'^polls/', include('polls.urls'))
>> url(r'^admin/', admin.site.urls),
>> ]
>>
>>
>>
>> Error:
>>
>> E:\Dropbox\Python Scripts\mysite>python manage.py runserver
>> Performing system checks...
>>
>> Unhandled exception in thread started by > check_errors..wrapper at 0x03F616A8>
>> Traceback (most recent call last):
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\utils\autoreload.py", line 226, in wrapper
>> fn(*args, **kwargs)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\management\commands\runserver.py", line 121,
>> in inner_run
>> self.check(display_num_errors=True)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\management\base.py", line 374, in check
>> include_deployment_checks=include_deployment_checks,
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\management\base.py", line 361, in _run_checks
>> return checks.run_checks(**kwargs)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\checks\registry.py", line 81, in run_checks
>> new_errors = check(app_configs=app_configs)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\checks\urls.py", line 14, in check_url_config
>> return check_resolver(resolver)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\core\checks\urls.py", line 24, in check_resolver
>> for pattern in resolver.url_patterns:
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\utils\functional.py", line 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\urls\resolvers.py", line 313, in url_patterns
>> patterns = getattr(self.urlconf_module, "urlpatterns",
>> self.urlconf_module)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\utils\functional.py", line 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib
>> \site-packages\django\urls\resolvers.py", line 306, in urlconf_module
>> return import_module(self.urlconf_name)
>>   File 
>> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py",
>> line 126, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 986, in _gcd_import
>>   File "", line 969, in _find_and_load
>>   File "", line 958, in
>> _find_and_load_unlocked
>>   File "", line 673, in _load_unlocked
>>   File "", line 661, in exec_module
>>   File "", line 767, in get_code
>>   File "", line 727, in
>> source_to_code
>>   File "", line 222, in
>> _call_with_frames_removed
>>   File "E:\Dropbox\Python Scripts\mysite\mysite\urls.py", line 21
>> url(r'^admin/', admin.site.urls),
>>   ^
>> SyntaxError: invalid syntax
>>
>>
>> Any help would be appreciated. Thank you.
>>
>> --
> 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 

Re: Error with Tutorial - Writing your first Django app, part 1

2016-12-09 Thread shah
Hi, I am facing the same issue with the tutorial.

I have got my program correct. But after running the sever. It shows an 
error on chrome.

Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/polls/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, 
in this order:

   1. ^admin/

The current URL, polls/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.

Since this is first ste of tutorial. I am not able to move forward. Thanx 
for rely in advance.

On Tuesday, 11 October 2016 02:12:30 UTC+5:30, Johnny McClung wrote:
>
> I am getting an error when I try to run the Django server. 
>
> >> mysite >> polls >> urls.py
> from django.conf.urls import url
>
>
> from . import views
>
> urlpatters = [
> url(r'^$', views.index, name='index'),
> ]
>
>
>
>
> >> mysite >> mysite >> urls.py
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^polls/', include('polls.urls'))
> url(r'^admin/', admin.site.urls),
> ]
>
>
>
> Error:
>
> E:\Dropbox\Python Scripts\mysite>python manage.py runserver
> Performing system checks...
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x03F616A8>
> Traceback (most recent call last):
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\autoreload.py",
>  
> line 226, in wrapper
> fn(*args, **kwargs)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\commands\runserver.py",
>  
> line 121, in inner_run
> self.check(display_num_errors=True)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
>  
> line 374, in check
> include_deployment_checks=include_deployment_checks,
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
>  
> line 361, in _run_checks
> return checks.run_checks(**kwargs)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\registry.py",
>  
> line 81, in run_checks
> new_errors = check(app_configs=app_configs)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
>  
> line 14, in check_url_config
> return check_resolver(resolver)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
>  
> line 24, in check_resolver
> for pattern in resolver.url_patterns:
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py",
>  
> line 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 313, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py",
>  
> line 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 306, in urlconf_module
> return import_module(self.urlconf_name)
>   File 
> "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py",
>  
> line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 986, in _gcd_import
>   File "", line 969, in _find_and_load
>   File "", line 958, in 
> _find_and_load_unlocked
>   File "", line 673, in _load_unlocked
>   File "", line 661, in exec_module
>   File "", line 767, in get_code
>   File "", line 727, in 
> source_to_code
>   File "", line 222, in 
> _call_with_frames_removed
>   File "E:\Dropbox\Python Scripts\mysite\mysite\urls.py", line 21
> url(r'^admin/', admin.site.urls),
>   ^
> SyntaxError: invalid syntax
>
>
> Any help would be appreciated. Thank you. 
>
>

-- 
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/8f685294-3a65-4fce-8be6-d8e46b5ec44c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Drawback of delete all migrations file

2016-12-09 Thread 'Abraham Varricatt' via Django users
Hello Sylvain,

I think you have two concerns here,

On Friday, December 9, 2016 at 1:39:50 PM UTC-5, Sylvain Dégué wrote:

> SO im thinking about reset completly my production database and remove all 
> the migrations to start fresh. I dont have much data in the production 
> database so its probably the best time.


>
> Is there any drawback to flushing the database and removing the migrations 
> files 


What is impact of removing migrations?
The migrations store information about how you changed your database schema 
over time. If this historical information is un-necessary for you, then 
there's no point in having it around.

What is impact of flushing the database?
This is something only you can answer - we have no knowledge of your 
business, and only you will know how best to support your customers. But 
since we are talking about a production database, might I offer an 
alternative? Take a backup of your database and store it somewhere. You 
don't need to keep it running, but having it around might be useful later 
on. 

Yours,
Abraham V.

-- 
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/0218756e-00b4-46ab-9eea-e1f01b491117%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Drawback of delete all migrations file

2016-12-09 Thread Matthew Pava
If you made any of your customizations to the migrations files, then you will 
lose that information.

You may want to consider using Django’s dumpdata management command to save all 
the data on your production database (and loaddata to restore it).
https://docs.djangoproject.com/en/1.10/ref/django-admin/#dumpdata

Otherwise, flush away.  During the development of my project, at least at the 
beginning, I always deleted all of the migration files until I settled on a 
model that worked for me and I started adding my own customizations to them.


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Sylvain Dégué
Sent: Friday, December 9, 2016 12:40 PM
To: Django users
Subject: Drawback of delete all migrations file

Im about to lauch a project that uses django for the api. So im only using the 
admin side for now. Ive been having problem concerning the database and forms.
Ive made many mistake while updating the database, when certain field didnt 
allow null. It caused IntegrityError, which I was able to fix

SO im thinking about reset completly my production database and remove all the 
migrations to start fresh. I dont have much data in the production database so 
its probably the best time.


Is there any drawback to flushing the database and removing the migrations files
--
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/bff6a050-8a28-48f4-abf2-57f17c3c8a04%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/fe0788257b314e4c9ebdb5a26cd62a63%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Drawback of delete all migrations file

2016-12-09 Thread Sylvain Dégué
Im about to lauch a project that uses django for the api. So im only using 
the admin side for now. Ive been having problem concerning the database and 
forms.
Ive made many mistake while updating the database, when certain field 
didnt allow null. It caused IntegrityError, which I was able to fix

SO im thinking about reset completly my production database and remove all 
the migrations to start fresh. I dont have much data in the production 
database so its probably the best time.


Is there any drawback to flushing the database and removing the migrations 
files 

-- 
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/bff6a050-8a28-48f4-abf2-57f17c3c8a04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django with MySQL DB for multitenancy

2016-12-09 Thread Peter Edache
Hello guys, we are currently looking for a way to migrate our previous 
django application to a full multi-tenant  application, currently the way 
we are handling our client is by giving each client a docker container and 
using nginx to do the routing, through sub-domain mapping.  But after 
researching i found, lot of article on multitenant using postgres sql but 
could not find a better approach for MySQL. Can anyone share a solution 
with me.
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff7515e9-5de5-46ef-9490-6a8e49c3c289%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Intermittent 'template not found' errors

2016-12-09 Thread Larry Martell
I have an app that is deployed at 15 sites and has been running for 6
years. All these deployments are with django 1.5, python 2.6, CentOS6,
and apache, and they all work perfectly. I just deployed the app at a
new site, but this one is django 1.9, python 2.7, CentOS7, and
nginx/uwsgi. Only at this site we are seeing intermittent 'template
not found' errors. A refresh of the page always works. It happens with
different templates, and there are no errors in any of the logs
(except for the template not found error). I've checked the system
logs, the nginx logs, the uwsgi logs and the django logs.

Anyone know why this would be happening, and/or how I can debug it further?

One thing I noticed, and this may be normal, but I don't know as I've
never encountered this error before, is that in the template not found
error when it lists the directories it searched, they all are in /tmp.
The template it is searching for does exist at
/usr/local/motor/motor/app/cdsem/templates/WaferToWafer/view.html but
it's looking in /tmp/app/cdsem/templates/WaferToWafer/view.html

Is that any indication of a problem?

This is the error I get:

TemplateDoesNotExist at /report/CDSEM/WaferToWafer/

WaferToWafer/view.html

This is the template search:

Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader:
/usr/local/motor/motor/ui/templates/WaferToWafer/view.html (Source
does not exist)
django.template.loaders.app_directories.Loader:
/usr/lib/python2.7/site-packages/django/contrib/admin/templates/WaferToWafer/view.html
(Source does not exist)
django.template.loaders.app_directories.Loader:
/usr/lib/python2.7/site-packages/django/contrib/auth/templates/WaferToWafer/view.html
(Source does not exist)
django.template.loaders.app_directories.Loader:
/tmp/core/alerts/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/core/reports/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/cdsem/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/semvision/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/developer/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/ui/templates/WaferToWafer/view.html (Source does not exist)
django.template.loaders.app_directories.Loader:
/tmp/configuration/templates/WaferToWafer/view.html (Source does not
exist)

And here is my TEMPLATES from settings:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'motor/ui/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'context_processors.config',
'ui.context_processors.navigation',
'core.appmngr.context_processor',
],
},
},
]

-- 
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/CACwCsY53sdqjWzKR5Hn6F_7Lsw1yPDuqJ6aw%3D223b766Zshqeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Translation problem !

2016-12-09 Thread Tim Graham
Sure, if translations are contributed by the community. Turkish is 
currently at 2%. The language is typically added to docs.djangoproject.com 
when the translations for the intro materials are completed.

https://www.transifex.com/django/django-docs/

On Friday, December 9, 2016 at 7:05:38 AM UTC-5, Özkan Nöron wrote:
>
> *Will there be a Turkish translation for Django? It becomes difficult to 
> learn a new language and programming language. 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac6c8b7b-e6c4-4bfc-9715-c075d7edb12c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


migrating a model from concrete inheritance to abstract inheritance

2016-12-09 Thread Riccardo Magliocchetti
Hello,

on django 1.8.17 i'm trying to convert a model Format away from inheriting 
from a concrete model DryModel and i get this running a migration that adds 
the id field:

django.core.exceptions.FieldError: Local field u'id' in class 'Format' 
clashes with field of similar name from base class 'DryModel'

I've already removed the pointer to DryModel in another migration. So 
migrations thinks my model is still inheriting from DryModel while if i 
open a shell and print the bases of format i correctly get:

In [2]: Format.__bases__
Out[2]: (myapp.models.AbstractModel,)

Any hint on how to handle that?

Thanks,
Riccardo Magliocchetti

-- 
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/98f59a44-50dd-469c-8e93-74878ca64634%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Translation problem !

2016-12-09 Thread Özkan Nöron
*Will there be a Turkish translation for Django? It becomes difficult to 
learn a new language and programming language. 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6af43660-dafe-4fe5-8013-7ded9f86cefa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.