Re: ORA-00942: table or view does not exist

2016-11-13 Thread Jani Tiainen
Are you sure that Django is complaing about that particula model? Have 
you tried to debug what model table is actually missing?


You could also popup in Django IRC channel on Freenode to get more 
realtime debugging help and feedback.


On 14.11.2016 02:32, Jeffrey Uvero wrote:

I removed double quotes in table name but I still got the same error.

On Fri, Nov 11, 2016 at 3:53 PM, Jani Tiainen > wrote:


Ok, since your model is not managed it doesn't create migrations
either.

If table name is written in uppercase, you can remove double
quotes, Oracle is by default uppercase and quoted format is only
required for tables or fields that are written in mixed or lowercase.

Are you sure that problem is really your model?


On 11.11.2016 02:03, Jeffrey Uvero wrote:

Jani Tiainen, Thank you for your response .

Yes, I am using legacy database , that's why I can't control the
naming of columns and tables

On Thu, Nov 10, 2016 at 4:16 PM, Jani Tiainen mailto:rede...@gmail.com>> wrote:

Oracle migrations are problematic due that fact that Oracle
DDL is not transactioned. So if something goes wrong you
can't rollback to previous state, your database ends up in
broken state (in theory django could clean it up).

Also try to avoid double quotes around table and column
names. You only need them if you're working with legacy
database where table names are written in lower case. Better
yet, let Django to take care of table names all together.



On 10.11.2016 03:45, Jeffrey Uvero wrote:

Thank you for your response ,,

Yes. I applied migration, when I applying for that, another
error comes out

 return self.cursor.execute(query,
self._param_generator(params))
django.db.utils.DatabaseError: ORA-00955: name is already
used by an existing object

On Thu, Nov 10, 2016 at 9:26 AM, Charly Román
mailto:chack14r...@gmail.com>> wrote:

Do you applied your migrations?

Charly Román
Software Developer
http://croman.mx 

2016-11-09 19:08 GMT-06:00 jeffreyequizuvero
mailto:jeffreyequizuv...@gmail.com>>:

/Hi everyone./
/
/
/I am new in Django Development and I encountered
this problem, please help/
/
/
/TIA/
/
/
/Jeffrey E. Uvero /


  DatabaseError at /login/

ORA-00942: table or view does not exist


Request Method: POST
Request URL:http://127.0.0.1:8000/login/
Django Version: 1.10.1
Exception Type: DatabaseError
Exception Value:

ORA-00942: table or view does not exist

*(This is ny model)*

class TblUser(models.Model): id =
models.IntegerField(primary_key=True) # AutoField?
user_code = models.CharField(max_length=50,
default=user_code_key) full_name =
models.CharField(max_length=50, blank=True,
null=True) firstname =
models.CharField(max_length=50, blank=True,
null=True) middlename =
models.CharField(max_length=50, blank=True,
null=True) lastname =
models.CharField(max_length=50, blank=True,
null=True) username =
models.CharField(max_length=50, blank=True,
null=True) password =
models.CharField(max_length=150, blank=True,
null=True) user_level =
models.CharField(max_length=50, default='user')
designation = models.CharField(max_length=50,
blank=True, null=True) email_address =
models.CharField(max_length=50, blank=True,
null=True) date_registered =
models.CharField(max_length=50,
default=datetime.now()) last_logged =
models.CharField(max_length=50, blank=True,
null=True) account_status =
models.CharField(max_length=50, default='ACTIVE')
verification = models.CharField(max_length=50,
default='1') sys_code =
models.CharField(max_length=50,
default=sys_code_key) class Meta: managed = False
db_table = '"TBLUSER"'

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

Re: Drawing with Django

2016-11-13 Thread Stephen McDonald
Check out https://github.com/stephenmcd/drawnby - I built it for the 2011 
Django Dash (and got 3rd place!). It lets users draw to a canvas element in 
the browser, and pushes the changes in real-time over web sockets, so 
multiple users can collaborate on the same image at the same time. It then 
stores and displays the results as PNG images.

I can't offer any support sorry, but hopefully having the source might help 
you out.

On Monday, 14 November 2016 07:48:31 UTC+11, Andrew Stringfield wrote:
>
> hello all,
>
>   I am interested in being able to draw on a Django view.  I have been 
> reading up some on how people draw in Html and it seems that the  
> tag seems to a good start.  Apparently I have to do some java scripting as 
> well.  What I envision is that I have a background image and then my users 
> can make annotations on the image and save the data...some how.  Any ideas?
>

-- 
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/81ddffc7-dbe4-4296-8f1a-b58015081a08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORA-00942: table or view does not exist

2016-11-13 Thread Jeffrey Uvero
I removed double quotes in table name but I still got the same error.

On Fri, Nov 11, 2016 at 3:53 PM, Jani Tiainen  wrote:

> Ok, since your model is not managed it doesn't create migrations either.
> If table name is written in uppercase, you can remove double quotes,
> Oracle is by default uppercase and quoted format is only required for
> tables or fields that are written in mixed or lowercase.
>
> Are you sure that problem is really your model?
>
>
> On 11.11.2016 02:03, Jeffrey Uvero wrote:
>
> Jani Tiainen, Thank you for your response .
>
> Yes, I am using legacy database , that's why I can't control the naming of
> columns and tables
>
> On Thu, Nov 10, 2016 at 4:16 PM, Jani Tiainen  wrote:
>
>> Oracle migrations are problematic due that fact that Oracle DDL is not
>> transactioned. So if something goes wrong you can't rollback to previous
>> state, your database ends up in broken state (in theory django could clean
>> it up).
>> Also try to avoid double quotes around table and column names. You only
>> need them if you're working with legacy database where table names are
>> written in lower case. Better yet, let Django to take care of table names
>> all together.
>>
>>
>>
>> On 10.11.2016 03:45, Jeffrey Uvero wrote:
>>
>> Thank you for your response ,,
>>
>> Yes. I applied migration, when I applying for that, another error comes
>> out
>>
>>  return self.cursor.execute(query, self._param_generator(params))
>> django.db.utils.DatabaseError: ORA-00955: name is already used by an
>> existing object
>>
>> On Thu, Nov 10, 2016 at 9:26 AM, Charly Román 
>> wrote:
>>
>>> Do you applied your migrations?
>>>
>>> Charly Román
>>> Software Developer
>>> http://croman.mx
>>>
>>> 2016-11-09 19:08 GMT-06:00 jeffreyequizuvero <
>>> jeffreyequizuv...@gmail.com>:
>>>
 *Hi everyone.*

 *I am new in Django Development and I encountered this problem, please
 help*

 *TIA*

 *Jeffrey E. Uvero *


 DatabaseError at /login/

 ORA-00942: table or view does not exist


 Request Method: POST
 Request URL: http://127.0.0.1:8000/login/
 Django Version: 1.10.1
 Exception Type: DatabaseError
 Exception Value:

 ORA-00942: table or view does not exist

 *(This is ny model)*

 class TblUser(models.Model):
 id = models.IntegerField(primary_key=True)  # AutoField?
 user_code = models.CharField(max_length=50, default=user_code_key)
 full_name = models.CharField(max_length=50, blank=True, null=True)
 firstname = models.CharField(max_length=50, blank=True, null=True)
 middlename = models.CharField(max_length=50, blank=True, null=True)
 lastname = models.CharField(max_length=50, blank=True, null=True)
 username = models.CharField(max_length=50, blank=True, null=True)
 password = models.CharField(max_length=150, blank=True, null=True)
 user_level = models.CharField(max_length=50, default='user')
 designation = models.CharField(max_length=50, blank=True, null=True)
 email_address = models.CharField(max_length=50, blank=True, null=True)
 date_registered = models.CharField(max_length=50, 
 default=datetime.now())
 last_logged = models.CharField(max_length=50, blank=True, null=True)
 account_status = models.CharField(max_length=50, default='ACTIVE')
 verification = models.CharField(max_length=50, default='1')
 sys_code = models.CharField(max_length=50, default=sys_code_key)

 class Meta:
 managed = False
 db_table = '"TBLUSER"'

 -- 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/ms
 gid/django-users/107cce9c-9795-40b9-ba74-194eb440b2bc%40goog
 legroups.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/ms
>>> gid/django-users/CABeWMUYkPcww6AcDu4CXJ%3DDjtOe3wL%3DT1uTEFY
>>> cuSWu4oH__vQ%40mail.gmail.com
>>> 

Re: Why was Roberto Rosario silently removed from the Django Software Foundation?

2016-11-13 Thread Daniele Procida
On Sun, Nov 13, 2016, Mario R. Osorio  wrote:

>Mr Rosario

We respectfully ask all users of this email list not to engage in discussions 
of this kind about individuals. It's not the place for it.

If anyone feels that they have been wronged or ill-treated by anyone else in or 
representing the Django Software Foundation, or by some part of the Django 
organisation, please contact the Board in confidence. They will receive a 
reply, and their concerns will be taken seriously. 

Thanks.

Daniele, on behalf of the DSF board

-- 
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/20161113230815.146739409%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Drawing with Django

2016-11-13 Thread Tim Chase
On 2016-11-13 21:55, ludovic coues wrote:
> It's barely related to django.
> 
> If all you want is to make annotation, it's fairly easy and you
> don't really need canvas and it's mainly javascript, which is
> independent from django.
> First, display your image.

Moreover, this sounds like a great opportunity to use SVG.  The text
in an SVG can be selectable while the text in a  isn't.  It's
easy to add text elements (or lines, pictures, icons, etc)
dynamically from a database as well.  It can be done server-side or
client-side as well.

Lots of benefits of SVG over Canvas for this.

-tkc


-- 
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/20161113151252.5d0a034d%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: Drawing with Django

2016-11-13 Thread Andrew Stringfield
Yup.  I am going to need it. lol  I have never done anything like this 
before.  It should be interesting.

On Sunday, November 13, 2016 at 3:56:40 PM UTC-5, ludovic coues wrote:
>
> It's barely related to django. 
>
> If all you want is to make annotation, it's fairly easy and you don't 
> really need canvas and it's mainly javascript, which is independent 
> from django. 
> First, display your image. 
> Second, get where your user want their annotation. I would do that by 
> listening to click event on the image and computing the position of 
> the click in the image, which is position of the click in the page 
> minus position of the image in the page. 
> Third, get the actual annotation. 
> Fourth, send to django a request to store an annotation on image Z at 
> position X / Y with text T. 
>
> Fifth is to display the image. Get all the annotation for the image, 
> display dot at the position of each annotation, display the text on 
> mousehover. Or directly on the image if the image is huge. 
>
> Good luck 
>
> 2016-11-13 21:48 GMT+01:00 Andrew Stringfield  >: 
> > hello all, 
> > 
> >   I am interested in being able to draw on a Django view.  I have 
> been 
> > reading up some on how people draw in Html and it seems that the 
>  
> > tag seems to a good start.  Apparently I have to do some java scripting 
> as 
> > well.  What I envision is that I have a background image and then my 
> users 
> > can make annotations on the image and save the data...some how.  Any 
> ideas? 
> > 
> > -- 
> > 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/168eba94-cb9e-4dfa-a761-4f478150dd2f%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
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/5464fd2a-9f09-4e83-ae55-27a4ec22dc5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Drawing with Django

2016-11-13 Thread ludovic coues
It's barely related to django.

If all you want is to make annotation, it's fairly easy and you don't
really need canvas and it's mainly javascript, which is independent
from django.
First, display your image.
Second, get where your user want their annotation. I would do that by
listening to click event on the image and computing the position of
the click in the image, which is position of the click in the page
minus position of the image in the page.
Third, get the actual annotation.
Fourth, send to django a request to store an annotation on image Z at
position X / Y with text T.

Fifth is to display the image. Get all the annotation for the image,
display dot at the position of each annotation, display the text on
mousehover. Or directly on the image if the image is huge.

Good luck

2016-11-13 21:48 GMT+01:00 Andrew Stringfield :
> hello all,
>
>   I am interested in being able to draw on a Django view.  I have been
> reading up some on how people draw in Html and it seems that the 
> tag seems to a good start.  Apparently I have to do some java scripting as
> well.  What I envision is that I have a background image and then my users
> can make annotations on the image and save the data...some how.  Any ideas?
>
> --
> 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/168eba94-cb9e-4dfa-a761-4f478150dd2f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTYv4LciFT2MQP7%3DbQRW6AVvkY2QfxuvMc%3DH_qH6P8y%2BTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Drawing with Django

2016-11-13 Thread Andrew Stringfield
hello all,

  I am interested in being able to draw on a Django view.  I have been 
reading up some on how people draw in Html and it seems that the  
tag seems to a good start.  Apparently I have to do some java scripting as 
well.  What I envision is that I have a background image and then my users 
can make annotations on the image and save the data...some how.  Any ideas?

-- 
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/168eba94-cb9e-4dfa-a761-4f478150dd2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why was Roberto Rosario silently removed from the Django Software Foundation?

2016-11-13 Thread Mario R. Osorio
*puts on DSF's Outsider hat* (ooops, hes's an outsider anyways)

FROM MY PERSPECTIVE AND THE LITTLE DATA I COULD COLLECT:

Mr Rosario might just be going through a Morphine down because of the 
medical procedure he is going through (been there myself!). Some people 
just have a very bad time out of it.

I did however, gather that he is comparing the events in Portland to what 
he feels he is going thru with DSF ... Does he seriously think he is THE 
trump??

At least, it is very clear to me that is how he feels. I hope he gets 
better.

Now, and again, just looking at his twitter account ... he is the one that 
started mixing politics with business, which hasn't yet proven to be a good 
combination (yeah, trump was ellected, but thats not even half the fight)

Maybe if he, or DSF, would publish a dossier of the events, we the people, 
might be able to have a better understanding of the issue.

If on the other hand, it wasn't your intention to make this issue public 
and open for all and any comments, maybe you failed by publishing this in 
the wrong place.



On Saturday, November 12, 2016 at 2:23:17 PM UTC-5, grandth...@gmail.com 
wrote:
>
> Dear Community,
>
> Roberto Rosario 
>
> https://twitter.com/siloraptor/status/797123511764615168
>
> From the fine tweet: "@chrismcdonough The process was mostly silent and 
> stealth (just one email, cancellation of access, etc)."
>
> Why injure the community and aspiring coders? Roberto himself has stated 
> to have funded at least 10k in python projects including making a 
> statement, "We ourselves pulled the plug on corporate sponsorship, 
> fellowship and Django kickstarters."
>
> https://twitter.com/siloraptor/status/797104759807348736
> From the fine tweet: "The mentality in Portland is representative of the 
> mentality of the Django Software Foundation, my expulsion proves it #Django 
> #Python"
>
> Let me just be very clear, if this is how people in the open source world 
> are going to be acting, don't be surprised if people are let go over their 
> social justice actions or beliefs. These types of actions only result in 
> fracturing, hurting the Django, Python and ultimately the open source 
> community.
>
> I'd love someone from the Django Software Foundation to take to time to 
> legitimately explain why someone was ejected out of the Django Software 
> Foundation over their political views.
>
> Also explain to me why I should retain anyone who wants to engage in PC or 
> SJW culture, as I'm more apt to terminate those who are intolerant of 
> opposing views.
>
> Sincerely,
> The Elder
>

-- 
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/c436df26-abf5-4b21-b815-d234fdfa0996%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best practices for directories in which to store stuff in production

2016-11-13 Thread Vineet Kothari
Check out cookiecutter django github

On Wed, Nov 9, 2016 at 7:49 PM, Vijay Khemlani  wrote:

> I prefer to keep everything in /home (at least the virtualenv, project
> code, settings and logs), that way you don't need special permissions to
> modify those files and it is more or less separated from the system files.
>
> static and media files in Amazon S3
>
> Caching... I used memcached, so I have no experience with using files in
> that regard
>
> On Wed, Nov 9, 2016 at 4:56 AM, ludovic coues  wrote:
>
>> If I had to use such scheme, I would put the django application in a
>> package for the target system. Like a .deb file for exemple.
>> If your primary way of deploying is a git push from test/QA to
>> production, split directory will cause plenty of headaches.
>>
>> Also, with an installation like this, I wouldn't use a virtualenv. By
>> using /usr/local/lib, you are making your application a part of the system.
>> It's like if a standard application was using a non-standard library. I
>> wouldn't expect that.
>>
>> But that's my 2 cents
>>
>> 2016-11-09 8:36 GMT+01:00 Antonis Christofides <
>> anto...@djangodeployment.com>:
>>
>>> Hello,
>>>
>>> I was thinking about using this scheme:
>>> /usr/local/lib/projectname
>>> Program files (i.e. repository)
>>> /usr/local/lib/projectname-virtualenv
>>> Virtualenv
>>> /var/lib/projectname/media
>>> Media files
>>> /var/cache/projectname/static
>>> Static files, collected with collectstatic
>>> /var/cache/projectname/cache
>>> File-based cache
>>> /var/log/projectname
>>> Log files
>>> /etc/projectname
>>> Configuration (mostly settings.py)
>>>
>>> I was wondering whether people could find it counter-intuitive, or
>>> whether there could be trouble training new recruits. I understand that
>>> some people are using /opt or /srv or /home, and that it may be common
>>> practice to put the virtualenv, static, and media files inside the
>>> repository working directory.
>>>
>>> My backup script automatically excludes /usr and /var/cache from backup,
>>> so I can decide what shall be backed up just by placing it in the
>>> appropriate directory. This is the main reason I put static files and
>>> file-based cache in /var/cache, and why I dislike schemes where program
>>> files and data are put in a single directory such as /srv/projectname.
>>> So how does the above look to you, and what other practices have you
>>> seen?
>>>
>>> (I'm asking primarily because I'm writing a book on Django deployment
>>> and I'm wondering what best practice to propose to the reader.)
>>>
>>> Thanks!
>>>
>>> --
>>> Antonis Christofideshttp://djangodeployment.com 
>>>
>>> --
>>> 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/ms
>>> gid/django-users/cc2851e9-89cc-3a87-aac6-b0532e5b2233%40djan
>>> godeployment.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>>
>> --
>> 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/ms
>> gid/django-users/CAEuG%2BTaU-BDeOAXf3iTVk7cLfMdwKSRV1GikFTTq
>> 4QxQW1xuPw%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CALn3ei0QWQvnG%2BsDdxK--S4cpdTi5RPnM8DstAxDxAoO9nspOg%
> 40mail.gmail.com
> 
> .
>
> For more options, visit https:

Re: Canonical way of handling multiple types of users? (Profiles vs subclassing django.contrib.auth.models.AbstractUser)

2016-11-13 Thread Vineet Kothari
Use one to many field or many to many field

On Wed, Nov 9, 2016 at 3:06 PM, Melvyn Sopacua 
wrote:

> Hi,
>
> > What is the current canonical way to handle multiple user-profiles in
> > Django?
>
> it highly depends on how you see these objects:
>
> 1. different types of users (requirement: a user can only be one type)
> 2. one type of user with additional information from different sources
> 3. different types of users, but users can be multiple types
>
> Obviously the third is the hardest.
>
>
> On Tuesday 08 November 2016 16:54:43 Victor Hooi wrote:
>
> > For example - say you have "Teachers", "Students", "Parents" - you may
> > have slightly different fields for each one and/or different
> > behaviour. Students will have things like grades, Parents may have
> > 1-to-many Students etc.
>
> Here you clearly think of them as types, instead of Humans and yet they
> can fulfill multiple roles. It also doesn't matter what is in the
> profile, as long as you don't care about enforcing required information
> at the model layer.
> You can make one profile model with the union of all fields and use
> group membership to enforce requirements. So a Human which is member of
> the Teachers group must have "date_employed" filled in while Student
> must have "date_enrolled". Similarly, you can use group membership to
> determine what information to show.
> Splitting them out in different profiles is a matter of preference and
> optimization, not of design.
>
> > The docs mention using a django.db.models.signals.post_save
> >  > signals.post_save> signal on User, but I'm guessing that won't work
> > here if you have multiple types of users.
>
> When you have multiple *profiles* this will work just fine. It's also
> not a big problem to solve, because user creation and updating is not an
> uncontrollable process like the docs suggest.
> User creation via commandline or automated process really only happens
> in tests and backup restore procedures.
>
> In production it's your job to properly set permissions for meddling
> with users in the admin and to provide forms that include relevant
> profile information. When providing good forms the signal is actually
> disruptive: you already have the information available, you save the
> user then save the profile information. Having a signal fire that
> doesn't have access to that profile information is not very useful and
> can lead to validation errors simply because the handler doesn't have
> the context.
>
> > Or are you better off subclassing
> > django.contrib.auth.models.AbstractUser? (I get the impression using
> > profile models is less invasive).
>
> The case for subclassing is really only one:
> Do you not have the right information in the standard user model to
> authenticate the user?
> Highly specialized cases aside, it's better to use profiles.
>
> A prominent example for not having the right information is when
> authentication happens with SSL certificates rather then
> username/password. Another is having different authentication servers
> and what server to use is depending on a field that isn't in the user
> model, like "faculty" or "signup_date.year".
>
> Hope this helps,
> --
> Melvyn Sopacua
>
> --
> 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/1678108.SszHfPmntC%40devstation.
> 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/CAAcanssSwCF48tS_HKisWfr-QRjCTtQFUL8uPZHqN1xqNr3NPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: init queryset return 'expected string or buffer'

2016-11-13 Thread ADEWALE ADISA
May be you should show your reservation model class. Because there, if you
make your food_name field to be equal to a foreignKey(Food), your form
class would be easier to write
On Nov 13, 2016 12:08 AM, "احسان خراسانی"  wrote:

> Hi
> my queryset return this error
>
> expected string or buffer
>
>
>
> class Reserve(forms.ModelForm):
> food_name = forms.ModelChoiceField(queryset=Food.objects.all())
>
> def __init__(self, year=None, month=None, day=None, serve_date=None, *
> args, **kwargs):
> super(Reserve, self).__init__(*args, **kwargs)
> self.year = year
> self.month = month
> self.day = day
> self.serve_date = serve_date
> date_stamp =  time.strptime(serve_date,"%Y-%m-%d")
> serve_date = datetime.date(*date_stamp[:3])
> self.fields['food_name'].queryset = Food.objects.filter(
> serve_date__year = year, serve_date__month = month,
> serve_date__day = day)
>
> class Meta:
> model = Reservation
> fields = ('food_count', 'food_name')
>
>
> --
> 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/0fac06b1-181c-45cf-8ba2-871f6a4beed7%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/CAMGzuy9f9WSULs4G_%3Dy8Ke7Ra4Z9RcRETKEh-0e-nH7vC-5jEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: init queryset return 'expected string or buffer'

2016-11-13 Thread ADEWALE ADISA
I think the argument to modelchoicefield  should be dictionary of string
not query set object.
On Nov 13, 2016 12:08 AM, "احسان خراسانی"  wrote:

> Hi
> my queryset return this error
>
> expected string or buffer
>
>
>
> class Reserve(forms.ModelForm):
> food_name = forms.ModelChoiceField(queryset=Food.objects.all())
>
> def __init__(self, year=None, month=None, day=None, serve_date=None, *
> args, **kwargs):
> super(Reserve, self).__init__(*args, **kwargs)
> self.year = year
> self.month = month
> self.day = day
> self.serve_date = serve_date
> date_stamp =  time.strptime(serve_date,"%Y-%m-%d")
> serve_date = datetime.date(*date_stamp[:3])
> self.fields['food_name'].queryset = Food.objects.filter(
> serve_date__year = year, serve_date__month = month,
> serve_date__day = day)
>
> class Meta:
> model = Reservation
> fields = ('food_count', 'food_name')
>
>
> --
> 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/0fac06b1-181c-45cf-8ba2-871f6a4beed7%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/CAMGzuy_MFkQLKv8f9Z79ZKL1%3DC4UUZ9qkJ-m8oTSOEJ9yq8iCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.