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

2016-11-09 Thread Melvyn Sopacua
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.


Re: Admin - saveasnew to another database

2016-11-09 Thread Melvyn Sopacua
On Wednesday 09 November 2016 13:59:35 Mike Dewhirst wrote:
> On 9/11/2016 9:13 AM, Tim Graham wrote:
> > Interesting idea. I'd be interested to here more about the use case.
> 
> Simple. I permitted my users to "play" on the staging site and now one
> of them wants to transfer their work to the production site.

Your approach is wrong. You think of this as one django project and 
trying to cheat under the hood, while in fact they are two different 
projects. And by design, staging is not always structually identical to 
production.

Your best approach is to use serialization with natural keys and a job 
scheduler. Cron will do, but there's plenty other schemes allowing you 
to provide feedback about the job queue and expected time of completion.
-- 
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/1646548.Z956crW7yG%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Admin - saveasnew to another database

2016-11-09 Thread Tim Graham
I see. Although I would be interested to see what you come up with, my 
initial reaction is that we wouldn't accept a patch for Django to do this. 
It seems too complex and brittle.

I agree with Melvyn that it seems unusual to use Django's multi-database 
facilities to transfer data between staging and production. 

On Wednesday, November 9, 2016 at 4:51:39 AM UTC-5, Melvyn Sopacua wrote:
>
> On Wednesday 09 November 2016 13:59:35 Mike Dewhirst wrote: 
> > On 9/11/2016 9:13 AM, Tim Graham wrote: 
> > > Interesting idea. I'd be interested to here more about the use case. 
> > 
> > Simple. I permitted my users to "play" on the staging site and now one 
> > of them wants to transfer their work to the production site. 
>
> Your approach is wrong. You think of this as one django project and 
> trying to cheat under the hood, while in fact they are two different 
> projects. And by design, staging is not always structually identical to 
> production. 
>
> Your best approach is to use serialization with natural keys and a job 
> scheduler. Cron will do, but there's plenty other schemes allowing you 
> to provide feedback about the job queue and expected time of completion. 
> -- 
> 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/ccfa9aef-d1c3-45e0-a894-c07a2701c1aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: strategies for adding a custom group permission

2016-11-09 Thread Melvyn Sopacua
On Tuesday 08 November 2016 09:55:51 Larry Martell wrote:

> I need to add a configurable data filter that will be used in my app
> and I want that filter to be specifiable at the django group level. I
> want to be able to give users permission, both at the group level and
> the user level, to edit this filter. But I want that permission to be
> separate and distinct from the general change group permission.
> 
> Anyone have a method to do this?

By design, you cannot relax permissions. You can grant and re-deny 
though or re-implement how change permission is determined. Wether you 
can determine "I should grant Change permission, even though the group 
doesn't have it, because the request is for editing the filter *only*" 
is tricky.

To grant change permission and then override it later, use the "user 
passes test" mechanism:


-- 
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/1940858.ZoTOQO7cGd%40devstation.
For more options, visit https://groups.google.com/d/optout.


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

2016-11-09 Thread Vijay Khemlani
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/
> msgid/django-users/CAEuG%2BTaU-BDeOAXf3iTVk7cLfMdwKSRV1GikFTT
> q4QxQW1xuPw%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://groups.google.com/d/optout.


Re: strategies for adding a custom group permission

2016-11-09 Thread Larry Martell
On Wed, Nov 9, 2016 at 8:32 AM, Melvyn Sopacua  wrote:
> On Tuesday 08 November 2016 09:55:51 Larry Martell wrote:
>
>> I need to add a configurable data filter that will be used in my app
>> and I want that filter to be specifiable at the django group level. I
>> want to be able to give users permission, both at the group level and
>> the user level, to edit this filter. But I want that permission to be
>> separate and distinct from the general change group permission.
>>
>> Anyone have a method to do this?
>
> By design, you cannot relax permissions. You can grant and re-deny
> though or re-implement how change permission is determined. Wether you
> can determine "I should grant Change permission, even though the group
> doesn't have it, because the request is for editing the filter *only*"
> is tricky.
>
> To grant change permission and then override it later, use the "user
> passes test" mechanism:
> 

I was able to do this by adding a custom admin index page, change_form
and some javascript.

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


Setting up jQuery in debian with virtualenv

2016-11-09 Thread Gary Roach

Hi all,

I am just starting to use jQuery and Ajax in my project and am having 
trouble setting things up.


I am using Eclipse + pyDev as an IDE. This setup stores everything in a 
workspace directory in my home directory. Instead of putting the whole 
project inside a virtualenv wrapper, things work better if the venv is 
external to the actual project files and the venv contents referenced in 
the Eclipse setup. In that venv file (djenv) there is the following:



/home/gary/workspace/djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js



Now to the setup of my main html page. According to W3schools.com I 
should include one of the following in the html head section:



 




 or


 
https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js";>



Neither of these fit my situation. I don't have a separate 
jquery-3.1.1.min.js file and don't want to use the google source.


What I wish to know is can I use something like:
> 
> "djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js"

>

or can I use just 

Using PyMySQL as a MySQL driver

Hi,

I have to use MySQL and an associated driver. Looking through the options 
in the docs 
 
my choices are limited since a) I use Python 3 and b) I can't use GPL code. 
Unless Django importing a GPL library does not qualify as linking in the 
GPL sense. Previous threads from django-dev suggest that it probably does.

Therefore, I can't use any of the listed drivers. I came across PyMySQL 
, which does seem to just drop in and 
work as it is PEP 249 compliant and is MIT licensed.

My question is does anyone have experience using PyMySQL, are there any 
reasons why I shouldn't use it or known issues? Is anyone using it in 
production?

Thanks in advance for any advice.

Cheers
Craig

-- 
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/ba9a5446-e64c-4ada-b1b3-c582ab50fa9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: External access


Here is an update on my situation.

Windows firewall - I setup in and outbound rules for port 8000 (UDP and TCP)
Router - I set up port forwarding for port 8000 (UDP and TCP)
Using example code in the socket module documentation I ram 
socket_client and socket_server on my local machine with the port=8000  
and host=my external IP . It worked just fine.
When I run the django server instead of the socket server and attempt 
browser access thru my external IP I get a timeout.

Nothing appears on the console running the server.

So something is different . Any ideas?

I presume that the browser - django server communication at most uses 
TCP and/or UDP.


Any ideas are welcome.

--
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/f102f6e2-ca8c-f6b2-43a4-51b1439d5ae5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up jQuery in debian with virtualenv

Hello,

Django provide tools to deals with static files like javascript or
css. The documentation is at [1].

[1] https://docs.djangoproject.com/en/1.10/howto/static-files/

2016-11-09 21:26 GMT+01:00 Gary Roach :
> Hi all,
>
> I am just starting to use jQuery and Ajax in my project and am having
> trouble setting things up.
>
> I am using Eclipse + pyDev as an IDE. This setup stores everything in a
> workspace directory in my home directory. Instead of putting the whole
> project inside a virtualenv wrapper, things work better if the venv is
> external to the actual project files and the venv contents referenced in the
> Eclipse setup. In that venv file (djenv) there is the following:
>
>>
>> /home/gary/workspace/djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js
>
>
>
> Now to the setup of my main html page. According to W3schools.com I should
> include one of the following in the html head section:
>
>>  
>> 
>> 
>
>
>  or
>
>>  
>> > src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js";>
>> 
>
>
> Neither of these fit my situation. I don't have a separate
> jquery-3.1.1.min.js file and don't want to use the google source.
>
> What I wish to know is can I use something like:
>> 
>> > "djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js"
>>
>
> or can I use just 

Re: Setting up jQuery in debian with virtualenv


Ludovic

Thank you for the reply but I know how to use static files. The problem 
is that I already have a jquery file under version control inside my 
virtual environment wrapper and do not wish to use an external file . 
Use of a normal static file will open my application up to uncontrolled 
version shifts. I want to know how to use the pip installed version of 
the jquery file if possible.


Gary R.

On 11/09/2016 01:41 PM, ludovic coues wrote:

Hello,

Django provide tools to deals with static files like javascript or
css. The documentation is at [1].

[1] https://docs.djangoproject.com/en/1.10/howto/static-files/

2016-11-09 21:26 GMT+01:00 Gary Roach :

Hi all,

I am just starting to use jQuery and Ajax in my project and am having
trouble setting things up.

I am using Eclipse + pyDev as an IDE. This setup stores everything in a
workspace directory in my home directory. Instead of putting the whole
project inside a virtualenv wrapper, things work better if the venv is
external to the actual project files and the venv contents referenced in the
Eclipse setup. In that venv file (djenv) there is the following:


/home/gary/workspace/djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js



Now to the setup of my main html page. According to W3schools.com I should
include one of the following in the html head section:


  




  or


  
https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js";>



Neither of these fit my situation. I don't have a separate
jquery-3.1.1.min.js file and don't want to use the google source.

What I wish to know is can I use something like:



Re: Setting up jQuery in debian with virtualenv

On 9 November 2016 at 13:54, Gary Roach  wrote:
> I want to know how to use the pip installed version of the jquery file if
> possible.


you can check what the admin templates do.   probably something like
{% url "admin/js/vendor/jquery/jquery.min.js" %}

-- 
Javier

-- 
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/CAFkDaoRCbDuYz83-9Y1Apj%2BWCAbB5Qp1a8EuHXa%2BFj0vHJ6N9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin - saveasnew to another database


On 10/11/2016 12:06 AM, Tim Graham wrote:

I see. Although I would be interested to see what you come up with,

@Tim
It is getting there so if you are really interested I'll post it 
somewhere when it is working. I'm getting router errors at the moment 
which I might be able to workaround by permitting null in a FK fields 
during obj.save(using=db). Might ask some questions on this later. I 
don't really want to permit null in this particular case.


my initial reaction is that we wouldn't accept a patch for Django to 
do this. It seems too complex and brittle.


Having done some work on this I agree with you but disagree with Melvyn.

The task is complex and would be almost impossible to generalise. For 
example, from a number of substances the user may have done serious work 
on only a few and won't want the others transferred.


So I'm building a facility to transfer one substance at a time. If there 
is a future requirement for bulk transfer I can iterate.


The transferred substance might be a mixture in which case I have to 
collect the ingredient substances plus the m2m through records which are 
effectively the recipe. Some of the ingredients might themselves be 
mixtures. Not worrying about that at the moment.


For each substance there are 6 OneToMany, up to 15 OneToOne and two m2m 
relationships plus a OneToOne where the sibling has lots of its own 
complex relationships including a recursive OneToOne to form a 
daisy-chain of history. I'm skipping that one for the moment.



I agree with Melvyn


See below

that it seems unusual to use Django's multi-database facilities to 
transfer data between staging and production.


On Wednesday, November 9, 2016 at 4:51:39 AM UTC-5, Melvyn Sopacua wrote:

On Wednesday 09 November 2016 13:59:35 Mike Dewhirst wrote:
> On 9/11/2016 9:13 AM, Tim Graham wrote:
> > Interesting idea. I'd be interested to here more about the use
case.
>
> Simple. I permitted my users to "play" on the staging site and
now one
> of them wants to transfer their work to the production site.

Your approach is wrong. You think of this as one django project and
trying to cheat under the hood, while in fact they are two different
projects. And by design, staging is not always structually
identical to
production.



@Melvyn

I was wrong to think saveasnew might do the trick.

However, migration is fully implemented so I can easily abort any 
transfer if the structures are not identical. As it happens, there are 
only two databases at the moment. Staging and production and while they 
are not always structurally identical they are currently the same during 
testing.




Your best approach is to use serialization with natural keys 



Maybe but the complexity and a couple of business rules persuade me to 
write code to do it "manually" so I can unit test it. Also, if I get it 
going, the user can select a substance to transfer and doesn't have to 
bother me.


I also realise it is very brittle so it needs to be revised if the 
structure changes.


Thanks for your advice. I appreciate it even if I think I need to tackle 
the problem my way.


Cheers

Mike


and a job
scheduler. Cron will do, but there's plenty other schemes allowing
you
to provide feedback about the job queue and expected time of
completion.
-- 
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/ccfa9aef-d1c3-45e0-a894-c07a2701c1aa%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/a905f7ad-18ca-72f3-b74c-07dd82c97412%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Non relational databases (MongoDB) with Django


I was wondering if you end up using MongoDB with Django, did you use non 
relational version of Django? how was your experience?

On Wednesday, August 17, 2016 at 1:28:31 AM UTC-7, Deep Shah wrote:
>
> I want to use MongoDB with Django. Which are the advisable, latest and 
> stable engines?
> I found https://github.com/django-nonrel/mongodb-engine which requires 
> the non relational version of Django (
> https://github.com/django-nonrel/django/). But they have not updated the 
> code since Django 1.6.
>

-- 
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/4a166a06-9b15-4681-829d-0241deac5e8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ORA-00942: table or view does not exist

*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/msgid/django-users/107cce9c-9795-40b9-ba74-194eb440b2bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

Do you applied your migrations?

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

2016-11-09 19:08 GMT-06:00 jeffreyequizuvero :

> *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/
> msgid/django-users/107cce9c-9795-40b9-ba74-194eb440b2bc%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/CABeWMUYkPcww6AcDu4CXJ%3DDjtOe3wL%3DT1uTEFYcuSWu4oH__vQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

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 
> :
>
>> *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%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/CABeWMUYkPcww6AcDu4CXJ%3DDjtOe3wL%3DT1uTEFYcuSWu4oH__
> vQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

*Jeffrey E. Uvero*

*Amellar Solution*

3rd Floor, LGI Building, Ortigas Avenue

Greenhills, San Juan City,

Philippines 1500

*Tel:* (+63) 9776824461

*SkypeID:* jeffrey.uvero

*Email:* j effreyequizuv...@gmail.com /
jeffeuw...@gmail.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/msgid/django-users/CAEtSeGvm-qos2qReYNrffLStbRiwiKFHU%3DP73A9%2BCtea14epSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up jQuery in debian with virtualenv

Hi,

If, as you say, you "have a jquery file under version control inside [your]
virtual environment wrapper", I believe you are doing something wrong. We
normally don't put jquery files in virtualenv (although `pip install django`
will do so), and we normally do not version control the virtualenv.

If virtualenv is not clear to you, I'd propose to take a look at
http://djangodeployment.com/2016/11/01/virtualenv-demystified/ and then re-ask
your question.

Regards,

Antonis Christofides
http://djangodeployment.com

On 2016-11-09 23:54, Gary Roach wrote:
> Ludovic
>
> Thank you for the reply but I know how to use static files. The problem is
> that I already have a jquery file under version control inside my virtual
> environment wrapper and do not wish to use an external file . Use of a normal
> static file will open my application up to uncontrolled version shifts. I want
> to know how to use the pip installed version of the jquery file if possible.
>
> Gary R.
>
> On 11/09/2016 01:41 PM, ludovic coues wrote:
>> Hello,
>>
>> Django provide tools to deals with static files like javascript or
>> css. The documentation is at [1].
>>
>> [1] https://docs.djangoproject.com/en/1.10/howto/static-files/
>>
>> 2016-11-09 21:26 GMT+01:00 Gary Roach :
>>> Hi all,
>>>
>>> I am just starting to use jQuery and Ajax in my project and am having
>>> trouble setting things up.
>>>
>>> I am using Eclipse + pyDev as an IDE. This setup stores everything in a
>>> workspace directory in my home directory. Instead of putting the whole
>>> project inside a virtualenv wrapper, things work better if the venv is
>>> external to the actual project files and the venv contents referenced in the
>>> Eclipse setup. In that venv file (djenv) there is the following:
>>>
 /home/gary/workspace/djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js

>>>
>>>
>>> Now to the setup of my main html page. According to W3schools.com I should
>>> include one of the following in the html head section:
>>>
   
 
 
>>>
>>>   or
>>>
   
 >>> src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js";>

 
>>>
>>> Neither of these fit my situation. I don't have a separate
>>> jquery-3.1.1.min.js file and don't want to use the google source.
>>>
>>> What I wish to know is can I use something like:
 
 >>> "djenv/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js"

 
>>> or can I use just