Re: [Django1.8.5] About migrate

2015-11-17 Thread Dennis Liou
Although it can syncdb, but I cannot reference ant thing...

Dennis Liou於 2015年11月17日星期二 UTC+8下午8時02分56秒寫道:
>
> Hi :
>
> I am new in Django, and I meet a bug.
>
> I was upgrade django from 1.5 to 1.8.
>
> My Django environment now is : Django 1.8.5 with python 2.7.10
>
>This is my auth models:
>   
>
> Class Card(models.Model):
> cardgroup = models.CharField(_('CardGroup'), max_length=60)
> cardname = models.CharField(_('CardName'), max_length=60)
> disabled = models.BooleanField(_('disabled'), default=False)
> objects = CardManager()
>
> class Meta:
> unique_together = (cardgroup', 'cardname')
> def __unicode__(self):
> return self.name
> @property
> def name(self):
> return '%s_%s' % (.self.cardgroup, self.cardname)
>
> Class Factory(models.Model):
>   sort = models.CharField(_('Short Name'), max_length=20, unique=True)
>   address = models.CharField(_('Factory address'), max_length=20)
>   cards = models.ManyToManyField(Card, blank=True)
>
>   def __unicode__(self):
> return self.short
>
>
>   After "#python manage.py migrate" twice , I got a error:
>
>   ValueError: Lookup failed for model referenced by field 
> core.auth.Factory.card:core.auth.core.auth.Card
>
> Because of that, I cannot syncdb ,either. 
>
> My auth apps was included in a core floder.
>
>
> Help me fix the bug, please. I was coming unstuck for a mouth. 
>
>

-- 
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/dde885db-05cd-454f-a264-b28e2d1e2214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django1.8.5] About migrate

2015-11-17 Thread Dennis Liou
Thanks, it works , I still need to debug another.

I use 

cards = models.ManyToManyField('Card')


Thanks for help.


Dennis Liou於 2015年11月17日星期二 UTC+8下午8時02分56秒寫道:
>
> Hi :
>
> I am new in Django, and I meet a bug.
>
> I was upgrade django from 1.5 to 1.8.
>
> My Django environment now is : Django 1.8.5 with python 2.7.10
>
>This is my auth models:
>   
>
> Class Card(models.Model):
> cardgroup = models.CharField(_('CardGroup'), max_length=60)
> cardname = models.CharField(_('CardName'), max_length=60)
> disabled = models.BooleanField(_('disabled'), default=False)
> objects = CardManager()
>
> class Meta:
> unique_together = (cardgroup', 'cardname')
> def __unicode__(self):
> return self.name
> @property
> def name(self):
> return '%s_%s' % (.self.cardgroup, self.cardname)
>
> Class Factory(models.Model):
>   sort = models.CharField(_('Short Name'), max_length=20, unique=True)
>   address = models.CharField(_('Factory address'), max_length=20)
>   cards = models.ManyToManyField(Card, blank=True)
>
>   def __unicode__(self):
> return self.short
>
>
>   After "#python manage.py migrate" twice , I got a error:
>
>   ValueError: Lookup failed for model referenced by field 
> core.auth.Factory.card:core.auth.core.auth.Card
>
> Because of that, I cannot syncdb ,either. 
>
> My auth apps was included in a core floder.
>
>
> Help me fix the bug, please. I was coming unstuck for a mouth. 
>
>

-- 
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/af0e9dd0-a459-4305-ad31-7764d693fbc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-17 Thread Axel Rau
Instead off writing an __init__ for the form class, I ended up with this 
get_form()
in my view class:

def get_form(self, form_class=None):
form = self.get_form_class()
pk = self.request.user.pk
self.object = Account.objects.get(pk=pk)
form_instance = form(instance=self.object)
self.filter_modelChoices(form_instance)
return form_instance

def filter_modelChoices(self, form_instance):
"""
Changes the model choice fields to be correctly filtered
 as required by request.user.
"""
opts = self.model._meta
for formfield_name in form_instance.fields:
formfield = form_instance.fields[formfield_name]
if isinstance(formfield, ModelChoiceField):
[modelfield] = 
[f for f in opts.fields if f.name == formfield_name]
qs = userVisibleFilterQS(
self.request.user.pk, 
False,
modelfield.related_model())
if qs:
formfield.queryset = formfield.queryset.filter(qs)


Am 16.11.2015 um 18:38 schrieb Axel Rau :

> Any idea how to add __init__() to a form class, created by modelform_factory 
> () ?


Axel
---
PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius

-- 
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/30621D2F-064C-4734-8669-FECACD1F3083%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.


Getting NoReverseMatch and can't find the mistake

2015-11-17 Thread Bob Aalsma
Sorry, can't seem to find what's wrong here, please help: what am I 
missing???

I'm seeing
NoReverseMatch at /zoekopdrachten/4/resultaat/

Reverse for 'resultaat' with arguments '('',)' and keyword arguments '{}' not 
found. 1 pattern(s) tried: 
[u'zoekopdrachten/(?P[0-9]+)/resultaat/$']

Request Method:GETRequest URL:
http://127.0.0.1:8000/zoekopdrachten/4/resultaat/Django Version:1.8.5Exception 
Type:NoReverseMatchException Value:

Reverse for 'resultaat' with arguments '('',)' and keyword arguments '{}' not 
found. 1 pattern(s) tried: 
[u'zoekopdrachten/(?P[0-9]+)/resultaat/$']

Exception 
Location:/Library/Python/2.7/site-packages/django/core/urlresolvers.py 
in _reverse_with_prefix, line 495Python Executable:/usr/bin/pythonPython 
Version:2.7.10


with *views.py*:
"""
zoekopdrachten: views.py

"""

from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.core.urlresolvers import reverse

from .models import KlantOrganisatie, ZoekVraag, ZoekVraagLocatie

#
#   Index - overzicht van opdrachtgever, contactpersonen en zoekvragen
def index(request):
organisatie_lijst = 
KlantOrganisatie.objects.order_by('klant_organisatie_naam')
context = {'organisatie_lijst': organisatie_lijst}
return render(request, 'zoekopdrachten/index.html', context)


#
#   Klantverwerking - contactpersoon noteert oordeel en motivatie bij 
aangeboden zoekresultaten
def klantverwerking(request, zoekvraag_id):
vraag = get_object_or_404(ZoekVraag, pk=zoekvraag_id)
return render(request, 'zoekopdrachten/klantverwerking.html', {'vraag': 
vraag})


#
#   Resultaat - inlezen zoekresultaten en opnemen in database bij 
ZoekVraagResultaat
def resultaat(request, zoekvraag_id):
vraag = get_object_or_404(ZoekVraag, pk=zoekvraag_id)
try:
keuze = 
vraag.zoekvraaglocatie_set.get(pk=request.POST['zoekvraaglocatie'])
except (KeyError, ZoekVraagLocatie.DoesNotExist):
return render(request, 'zoekopdrachten/vraag.html', {
'vraag': vraag,
'error_message': 'Ongeldige keuze of zoiets',
})
else:
keuze.zoek_vraag_locatie = 'kippenfarm'
keuze.save()
return 
HttpResponseRedirect(reverse('zoekopdrachten:zelfverwerking.html', 
args=(vraag.id,)))


#
#   Vraag - details van de zoekvraag
def vraag(request, zoekvraag_id):
vraag = get_object_or_404(ZoekVraag, pk=zoekvraag_id)
return render(request, 'zoekopdrachten/vraag.html', {'vraag': vraag})


#
#   Zelfverwerking - opnemen zoekresultaten in databsae plus eigen 
beoordeling
def zelfverwerking(request, zoekvraag_id):
vraag = get_object_or_404(ZoekVraag, pk=zoekvraag_id)
return render(request, 'zoekopdrachten/zelfverwerking.html', {'vraag': 
vraag})

and *urls.py*:
""" 
zoekopdrachten: urls.py

"""

from django.conf.urls import url

from . import views

urlpatterns = [
# ex: /zoekopdrachten/
url(r'^$', views.index, name='index'),
# ex: /zoekopdrachten/5/
url(r'^(?P[0-9]+)/$', views.vraag, name='vraag'),
# ex: /zoekopdrachten/5/zelfverwerking/
url(r'^(?P[0-9]+)/zelfverwerking/$', 
views.zelfverwerking, name='zelfverwerking'),
# ex: /zoekopdrachten/5/klantverwerking/
url(r'^(?P[0-9]+)/klantverwerking/$', 
views.klantverwerking, name='klantverwerking'),
# ex: /zoekopdrachten/5/resultaat/
url(r'^(?P[0-9]+)/resultaat/$', views.resultaat, 
name='resultaat'),
]


and *vraag.html*:
Zoekvraag "{{ vraag.zoekvraag_id }}"

{% if error_message %}
{{ error_message }}

{% endif %}

Verzamelen resultaten

{% csrf_token %}
{% for term in vraag.zoekvraagterm_set.all %}

1
{% endfor %}












-- 
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/d6e5eb3f-c7bc-4890-8c31-c5622f6a9bb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Domain Driven Development

2015-11-17 Thread Tom Christie
Hi Alex,

I've written previously about encapsulation and Django models 
, and I think 
that's kinda relevant here.
If you apply the policy "never write to a model or call .save() directly" 
then yes, you can ensure that the only access points
for modifying the state of eg 'line items', is eg the owning 'order' 
instance.

In some cases there may not be an order instance as such (eg if you simply 
have an order id against the line items, but no fully fledged 'order' table 
in your database) in which case you'd apply the encapsulation either in the 
LineItem manager class, or in a helper class that represents and interacts 
with orders, but does not map directly to a database table itself.

A final consideration here is that these sorts of case *might* map well to 
cases where you want an element of document-structure in your data models, 
rather than relational  structure. (eg. a JSON field against the order that 
stores line item data) that call depends on what information you're going 
to need to index aggregate etc. Probably not what you need, but worth 
mentioning as an option.

Hope that helps give some food for thought.


  T.

-- 
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/e390b879-21c3-4f93-935c-768d4b89ae8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django1.8.5] About migrate

2015-11-17 Thread aRkadeFR

Hey,

What is the code of your managers and what's the full stacktrace?
You can use dpaste.de as a pastebin :)

For the related field, iirc, it's recommended to reference them with a  
string.


try to change this

cards = models.ManyToManyField(Card, blank=True)

by:

cards = models.ManyToManyField('app.Card')


On 11/17/2015 04:45 AM, Dennis Liou wrote:

Hi :

I am new in Django, and I meet a bug.

I was upgrade django from 1.5 to 1.8.

My Django environment now is : Django 1.8.5 with python 2.7.10

   This is my auth models:

Class Card(models.Model):
 cardgroup = models.CharField(_('CardGroup'), max_length=60)
 cardname = models.CharField(_('CardName'), max_length=60)
 disabled = models.BooleanField(_('disabled'), default=False)
 objects = CardManager()

 class Meta:
 unique_together = (cardgroup', 'cardname')
 def __unicode__(self):
 return self.name
 @property
 def name(self):
 return '%s_%s' % (.self.cardgroup, self.cardname)

Class Factory(models.Model):
   sort = models.CharField(_('Short Name'), max_length=20, unique=True)
   address = models.CharField(_('Factory address'), max_length=20)
   cards = models.ManyToManyField(Card, blank=True)

   def __unicode__(self):
 return self.short


   After "#python manage.py migrate" twice , I got a error:

   ValueError: Lookup failed for model referenced by 
fieldcore.auth.Factory.card:core.auth.core.auth.Card

 Because of that, I cannot syncdb ,either.

 My auth apps was included in a core floder.

 Help me fix the bug, please. I wascoming unstuck for a mouth.
--
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/a811320a-efb8-425f-aa0c-bd68df4191f9%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
aRkadeFR

--
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/564B4A78.3010405%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: django seems does not support mysql 5.7.9

2015-11-17 Thread Pengfei Xue
thanks, i reinstall mysql-python, it's working now, very frustrating. 


On Tuesday, November 17, 2015 at 9:27:03 PM UTC+8, Tom Evans wrote:
>
> On Tue, Nov 17, 2015 at 11:44 AM, Pengfei Xue  > wrote: 
> > yesterday, i upgraded my local mysql server to 5.7.9 (mysql  Ver 14.14 
> > Distrib 5.7.9, for osx10.11 (x86_64) using  EditLine wrapper), and 
> > found i can not make my app run anymore, find this error, is there some 
> one 
> > else get this error before? 
> > 
> > MySQL-python==1.2.5 
>
> mysql-python (MySQLdb) uses a C extension that would be dynamicly 
> linked to the mysql client libraries from your older version of mysql. 
> Did you reinstall and recompile this after upgrading to a newer 
> version of the client libraries? 
>
> Another alternative is that mysql server no longer supports the client 
> API that mysql-python is presenting. You can mostly connect to older 
> servers using newer client libraries, you can't always connect to 
> newer servers using older client libraries. There are alternative 
> mysql/python connectors available: 
>
> https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers 
>
> 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/43300720-a7f5-4a3e-a8ba-deee4c92ec49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django seems does not support mysql 5.7.9

2015-11-17 Thread Pengfei Xue
thanks, i reinstall mysql-python, it's working now, very frustrating. 


On Tuesday, November 17, 2015 at 9:27:03 PM UTC+8, Tom Evans wrote:
>
> On Tue, Nov 17, 2015 at 11:44 AM, Pengfei Xue  > wrote: 
> > yesterday, i upgraded my local mysql server to 5.7.9 (mysql  Ver 14.14 
> > Distrib 5.7.9, for osx10.11 (x86_64) using  EditLine wrapper), and 
> > found i can not make my app run anymore, find this error, is there some 
> one 
> > else get this error before? 
> > 
> > MySQL-python==1.2.5 
>
> mysql-python (MySQLdb) uses a C extension that would be dynamicly 
> linked to the mysql client libraries from your older version of mysql. 
> Did you reinstall and recompile this after upgrading to a newer 
> version of the client libraries? 
>
> Another alternative is that mysql server no longer supports the client 
> API that mysql-python is presenting. You can mostly connect to older 
> servers using newer client libraries, you can't always connect to 
> newer servers using older client libraries. There are alternative 
> mysql/python connectors available: 
>
> https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers 
>
> 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/e4009565-f4ca-42fe-8b32-5e9d675cb49c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timer for online examination

2015-11-17 Thread bobhaugen
On Tuesday, November 17, 2015 at 12:29:02 AM UTC-6, Arindam sarkar wrote:
>
> I am developing an online examination website. And having difficulty 
> implementing the timer .
> Any one have done it or something related to countdown timer in django ?
>
>
Here is an example of what everybody is telling you to do in javascript:
https://github.com/valnet/valuenetwork/blob/master/valuenetwork/templates/valueaccounting/work_now.html

Look for runTime and retryTimer 

-- 
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/635f5faa-257f-4aa0-b6e0-9be706032223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django seems does not support mysql 5.7.9

2015-11-17 Thread 'Tom Evans' via Django users
On Tue, Nov 17, 2015 at 11:44 AM, Pengfei Xue  wrote:
> yesterday, i upgraded my local mysql server to 5.7.9 (mysql  Ver 14.14
> Distrib 5.7.9, for osx10.11 (x86_64) using  EditLine wrapper), and
> found i can not make my app run anymore, find this error, is there some one
> else get this error before?
>
> MySQL-python==1.2.5

mysql-python (MySQLdb) uses a C extension that would be dynamicly
linked to the mysql client libraries from your older version of mysql.
Did you reinstall and recompile this after upgrading to a newer
version of the client libraries?

Another alternative is that mysql server no longer supports the client
API that mysql-python is presenting. You can mostly connect to older
servers using newer client libraries, you can't always connect to
newer servers using older client libraries. There are alternative
mysql/python connectors available:

https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers

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


Re: Timer for online examination

2015-11-17 Thread Robin Lery
Yes, that's true.

On Tue, Nov 17, 2015 at 4:52 PM, Jani Tiainen  wrote:

> Hello,
>
> As I said, on client side doing timer requires javascript usage. But it
> doesn't remove need to actually make sure that no-one can manipulate
> duration of exam.
>
> It's really trivial to have piece of javascript that would render plain
> javascript timer useless (like you could fill out form forever).
>
> So to make sure cheating doesnt happen - at the moment exam is created
> exam end time should be recorderd on server side as well (in database for
> example). So even someone manages to hack the js (which is really simple)
> they can't overcome limitation from the server.
>
> Like the rule #1 in web development says - "Never trust user input".
>
>
> On 17.11.2015 09:47, Robin Lery wrote:
>
> Hello,
> I think you will  have to implement jquery/javascript to make the timer.
> After the countdown finishes js can post the form automatically.
>
> Cheers.
>
> On Tue, Nov 17, 2015 at 1:11 PM, Jani Tiainen  wrote:
>
>> Hi,
>>
>> If you're looking something magical there isn't anything. Just declare
>> expiracy timestamp and compare against it in code. It should be rather
>> trivial to do with JS down counter to UI for mode concrete feedback to end
>> user.
>>
>> But keep final word of expiracy in Django code.
>>
>>
>> On 17.11.2015 08:28, Arindam sarkar wrote:
>>
>> I am developing an online examination website. And having difficulty
>> implementing the timer .
>> Any one have done it or something related to countdown timer in django ?
>>
>> --
>> Regards,
>>
>> Arindam
>>
>> Contact no. 08732822385
>>
>>
>> --
>> 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/CAGnF%2BrAAv5DYpPWVxxOGV8%2BsE_w%3DKEhYSnBVArnRTggPuWXfyQ%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 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/564ADA2D.501%40gmail.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/CA%2B4-nGp_1wr-DeObEnrV9GvtpbvcY5hj%2B7R9%2Bqy3n81F6dFHtg%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 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/564B0E10.50109%40gmail.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 

[Django1.8.5] About migrate

2015-11-17 Thread Dennis Liou
Hi :
   
I am new in Django, and I meet a bug.

I was upgrade django from 1.5 to 1.8.

My Django environment now is : Django 1.8.5 with python 2.7.10

   This is my auth models:
  

Class Card(models.Model):
cardgroup = models.CharField(_('CardGroup'), max_length=60)
cardname = models.CharField(_('CardName'), max_length=60)
disabled = models.BooleanField(_('disabled'), default=False)
objects = CardManager()

class Meta:
unique_together = (cardgroup', 'cardname')
def __unicode__(self):
return self.name
@property
def name(self):
return '%s_%s' % (.self.cardgroup, self.cardname)

Class Factory(models.Model):
  sort = models.CharField(_('Short Name'), max_length=20, unique=True)
  address = models.CharField(_('Factory address'), max_length=20)
  cards = models.ManyToManyField(Card, blank=True)

  def __unicode__(self):
return self.short


  After "#python manage.py migrate" twice , I got a error:

  ValueError: Lookup failed for model referenced by field 
core.auth.Factory.card:core.auth.core.auth.Card

Because of that, I cannot syncdb ,either. 

My auth apps was included in a core floder.


Help me fix the bug, please. I was coming unstuck for a mouth. 

-- 
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/a811320a-efb8-425f-aa0c-bd68df4191f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Django 1.8.5] models bug when migrate.

2015-11-17 Thread Dennis Liou
Hi :
   
I am new in Django, and I meet a bug.

My Django environment is : Django 1.8.5 with python 2.7.10

I was upgrade my django from 1.5 to 1.8

This is my auth models:
  

Class Card(models.Model):
cardgroup = models.CharField(_('CardGroup'), max_length=60)
cardname = models.CharField(_('CardName'), max_length=60)
disabled = models.BooleanField(_('disabled'), default=False)
objects = CardManager()

class Meta:
unique_together = (cardgroup', 'cardname')
def __unicode__(self):
return self.name
@property
def name(self):
return '%s_%s' % (.self.cardgroup, self.cardname)

Class Factory(models.Model):
  sort = models.CharField(_('Short Name'), max_length=20, unique=True)
  address = models.CharField(_('Factory address'), max_length=20)
  cards = models.ManyToManyField(Card, blank=True)

  def __unicode__(self):
return self.short


  After "#python manage.py migrate" twice , I got a error:

  ValueError: Lookup failed for model referenced by field 
core.auth.Factory.card:core.auth.core.auth.Card


Because of that, I can not syncdb ,either. 

PS. My core apps were in a "core" folder.


Help me fix the bug, please. I was coming unstuck for a mouth.

-- 
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/32d2e0f9-15d3-4730-8e71-dbf576feb1b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django seems does not support mysql 5.7.9

2015-11-17 Thread Pengfei Xue
yesterday, i upgraded my local mysql server to 5.7.9 (mysql  Ver 14.14 
Distrib 5.7.9, for osx10.11 (x86_64) using  EditLine wrapper), and
found i can not make my app run anymore, find this error, is there some one 
else get this error before?

MySQL-python==1.2.5
Django==1.8.6

  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/base/base.py",
 
line 462, in temporary_connection
cursor = self.cursor()
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/base/base.py",
 
line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/base/base.py",
 
line 135, in _cursor
self.ensure_connection()
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/base/base.py",
 
line 130, in ensure_connection
self.connect()
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/base/base.py",
 
line 119, in connect
self.connection = self.get_new_connection(conn_params)
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/django/db/backends/mysql/base.py",
 
line 276, in get_new_connection
conn = Database.connect(**conn_params)
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/MySQLdb/__init__.py",
 
line 81, in Connect
return Connection(*args, **kwargs)
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/MySQLdb/connections.py",
 
line 221, in __init__
self.set_character_set(charset)
  File 
"/Users/pengfei/Code/gengmei/.gaia/lib/python2.7/site-packages/MySQLdb/connections.py",
 
line 312, in set_character_set
super(Connection, self).set_character_set(charset)

-- 
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/8f969a56-a601-4a41-aacc-3cb55cdbc6a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timer for online examination

2015-11-17 Thread Jani Tiainen

Hello,

As I said, on client side doing timer requires javascript usage. But it 
doesn't remove need to actually make sure that no-one can manipulate 
duration of exam.


It's really trivial to have piece of javascript that would render plain 
javascript timer useless (like you could fill out form forever).


So to make sure cheating doesnt happen - at the moment exam is created 
exam end time should be recorderd on server side as well (in database 
for example). So even someone manages to hack the js (which is really 
simple) they can't overcome limitation from the server.


Like the rule #1 in web development says - "Never trust user input".

On 17.11.2015 09:47, Robin Lery wrote:

Hello,
I think you will  have to implement jquery/javascript to make the 
timer. After the countdown finishes js can post the form automatically.


Cheers.

On Tue, Nov 17, 2015 at 1:11 PM, Jani Tiainen > wrote:


Hi,

If you're looking something magical there isn't anything. Just
declare expiracy timestamp and compare against it in code. It
should be rather trivial to do with JS down counter to UI for mode
concrete feedback to end user.

But keep final word of expiracy in Django code.


On 17.11.2015 08:28, Arindam sarkar wrote:

I am developing an online examination website. And having
difficulty implementing the timer .
Any one have done it or something related to countdown timer in
django ?

-- 
Regards,


Arindam

Contact no. 08732822385


-- 
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/CAGnF%2BrAAv5DYpPWVxxOGV8%2BsE_w%3DKEhYSnBVArnRTggPuWXfyQ%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 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/564ADA2D.501%40gmail.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/CA%2B4-nGp_1wr-DeObEnrV9GvtpbvcY5hj%2B7R9%2Bqy3n81F6dFHtg%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 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/564B0E10.50109%40gmail.com.
For more options, visit https://groups.google.com/d/optout.