On Mon, Jul 6, 2015 at 11:47 AM, Lee Kazushi <[email protected]> wrote:

> Hi everyone,
>
> I am newbie in django so i'm a bit confused on some  features. I have to
> do a project for university. It consists in a desktop-web app where
> employees can do some staff like handle files, recording files, uploading
> files on a mysql database, and an ios native app (written in objective c)
> where a user can register himself, log in and ask for the data that the
> employees have saved early.
> First of all:  It's possible to do a server app that communicates with an
> ios app (sending-recieve data, notifications) using django-frameworks (and
> i suppose also django-rest-framework)? If yes, do you have some
> tutorials/guide/book to suggest to understand better how this communication
> work and how i can really do this thing?
>
Yes, this is possible. The main difference between a web app that
communicates with a browser and one that communicates with a mobile
application is that while a the first has to deliver DATA and LAYOUT, the
second only needs to send DATA, because the layout is already programmed in
obejective-c. And this is were Django-REST-framework (DRF) comes handy.
Pure Django is mainly thought to deliver templates with HTML (data and
layout) code, DRF simply adds a layer to the framework so it can return
data using popular formats like: JSON, XML, yaml. So keep in mind DRF only
helps you doing the job, you could also provide this kind of data using
pure Django without DRF.

>
> My second question is related to Custumizing Users on Django.
> For my project i need two classes of user:
> - Employee (with registration_id as primary key): this user can only log
> in on desktop-app
> - Driver : this user can only log in  on ios-app
>
> can i have multiple custom users, for instance :
> class Employees(AbstractBaseUser):
> registration_id = models.IntegerField(max_length=10,unique=True,
> null=True, blank=True)
>     first_name = models.CharField(max_length=30, null=True, blank=True)
> last_name = models.CharField(max_length=60, null=True, blank=True)
>         #etc etc etc
>
> class Driver(AbstractBaseUser):
>        license_plate =....
>        first_name = ....
>        #etc etc etc
>
>
> is that reasonable?
>
This i reasonable but you will end up with some problems. Django is thought
to have a single user table and this is the behavior most third part
django-app (django plugins or extensions) expect. My advise would be to
have a single user table, than you can use one of the many strategies to
differentiate types of users, for example:
- Boolean field indication
- A separate "profile" model

>
> Sorry for my bad English.
> I will appeciate any kind of help
> Thank you
> Cheers
>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/2aa960dd-1b95-427e-bb41-c497fcb6333c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2aa960dd-1b95-427e-bb41-c497fcb6333c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


*Filipe Ximenes*+55 (81) 8245-9204

*Vinta Software Studio*http://www.vinta.com.br

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAA-QWB3skW5j3fLaXDTTcD1784rtjNYp8c1gB3qiFD2Bv7_q%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to