Re: Django App plugins

2018-07-29 Thread Melvyn Sopacua
On zondag 29 juli 2018 23:14:34 CEST Christian González wrote:
> On zondag 29 juli 2018 11:02:30 CEST Christian González wrote:

> > There might also be another reason and that is that in the Python
> > community, there's a good realisation that downloadable and instantly
> > installable plugins for a web project without dev(ops) interference
> > isn't necessarily a good thing.
> 
> Mh, not really. Look at Owncloud/Nextcloud. Is PHP, but a good example
> that this works. 

I have a good amount of experience with Magento, which has the same principle 
and dealt with all the downsides of it. But I personally don't know of any 
similar project within the Python community.

Doesn't mean it doesn't exist, just not as wide spread and after having dealt 
with the security holes, low quality not performing code, layout breakers and 
what not - I can't say I'm surprised. Magento has invested quite a bit in ways 
to check code quality on everything that hits the store.

Either way, keep in mind that you're not going to solve this *just* at the 
Django layer. You'll need some way to trigger the WSGI processor to load the 
new code in a safe manner and then run migrations. Good luck!

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


Django template cheat sheet or ebook

2018-07-29 Thread aditya gupta
Can anyone tell me where I can find Django template cheat sheet or ebook.

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


Re: I want to remove username unique and its validation from django i tried but not working

2018-07-29 Thread Phako Perez
You want to update an unique field as null which is wrong, you aren’t able to 
insert update a field marked as unique instead you can remove the entire row, 
if you wanted to track all users on your table you can add 2 fields to the 
table, 1 for the update date and other for a flag which can tell you if the 
user is actually marked as super user or not, this may cause more code needed 
in your application to let it know about this new feature

Regards

Sent from my iPhone

> On Jul 29, 2018, at 3:21 AM, lalitaquasoft  wrote:
> 
> Getting this error :
> 
> I have tried to change username nul but not working   
> 
> 
> IntegrityError at /register/
> 
> UNIQUE constraint failed: superuser_user.username
> 
> please help me on this issue . It will take too much time `
> 
> 
> -- 
> 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/089669f1-1f0a-41b9-9684-98363169c8ac%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/4549B2B8-B091-491A-B180-A7B740E679A9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django App plugins

2018-07-29 Thread Christian González
On zondag 29 juli 2018 11:02:30 CEST Christian González wrote:
>> anyone? I wondered if I'm the only one that has such a use case? 
>
> I think so. Why not distribute it as a Django **project** so the
> plugins are reusable apps.
I think that's the best idea yet. My application will be a -eh- "bigger"
one sometimes.
>
> You can also nest apps, like "coolstuff.plugins.*". It may get tricky
> with unique app labels though. 
That's no problem. server side filtering in the app store.

> There might also be another reason and that is that in the Python
> community, there's a good realisation that downloadable and instantly
> installable plugins for a web project without dev(ops) interference
> isn't necessarily a good thing.
Mh, not really. Look at Owncloud/Nextcloud. Is PHP, but a good example
that this works. My plans are similar.
But I'm convinced ATM that squeezing Django itself into a pluggable apps
evolvement isn't the best idea.

I'll go with plugins that are separate entities, although that means
that I have to reimplement migrations and module loading myself. But
everything else is easier then.


-- 
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/94dad3d9-8962-708b-2839-995259fa6f6e%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.


Re: Django Login Error

2018-07-29 Thread Melvyn Sopacua
On zondag 29 juli 2018 14:07:19 CEST Kasper Laudrup wrote:

> On 2018-07-29 10:27, lalitaquasoft wrote:
> > How to remove Unique username
> 
> How would you expect user management to work if usernames are not unique?

By using split fields. I've ran into this as well, as I want to allow the same 
username per different domain - ya know, like emails.

I ended up with a choice to duplicate the data as a single database field or 
ditch django.contrib.auth. I went for solving the problem at the form level 
and not storing the username / domain in the custom user model, but storing it 
as an email field that had to be unique.
-- 
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/2157237.Hh3KulHEcb%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Django App plugins

2018-07-29 Thread Melvyn Sopacua
On zondag 29 juli 2018 11:02:30 CEST Christian González wrote:
> anyone?
> I wondered if I'm the only one that has such a use case? 

I think so. Why not distribute it as a Django **project** so the plugins are 
reusable apps.
You can also nest apps, like "coolstuff.plugins.*". It may get tricky with 
unique app labels though.

Anyway, there's plenty of examples of Django based software that is 
distributed as a project. Mezzanine is one of them.

There might also be another reason and that is that in the Python community, 
there's a good realisation that downloadable and instantly installable plugins 
for a web project without dev(ops) interference isn't necessarily a good 
thing.
-- 
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/1703732.VyyS66Gq1u%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: File-Backend or Filemanagement

2018-07-29 Thread Melvyn Sopacua
On zondag 29 juli 2018 10:50:58 CEST Muri Nicanor wrote:

> i'm writing a Django application that has the management of textfiles on
> the server as one of the requirements. I've already created a model that
> parses the textfiles and provides a way of editing the files. To choose
> the indivdiual textfiles i created a simple view that does a file
> listing (basically an os.listdir()), but that is not really a flexible
> solution (i.e. i would like to have pagination).

Please don't reinvent the wheel. There's plenty to choose from.
https://djangopackages.org/grids/g/file-managers/
-- 
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/2952161.smV9ToK1WU%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Django Login Error

2018-07-29 Thread Deepak sharma
I recommend :* DON'T,* because it is by default UserIdentifier, It is used 
to make UserLogins and you have to override a lot of builtIns to achieve 
what you are trying to do.
 

But if you still want to:

`username` validator is defined in AbstractUser Class, and inheritence flow 
is like: 

AbstractUser -> User

i believe only way to overide this validation is to create a Proxy Model


Discussion here: 
https://groups.google.com/forum/#!topic/django-developers/rb7v9kVAK3I




On Sunday, July 29, 2018 at 5:14:23 PM UTC+5:30, lalitaquasoft wrote:
>
> IntegrityError at /register/
>
> UNIQUE constraint failed: superuser_user.username 
>
>
>
> How to remove Unique username 
>
>

-- 
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/9405b6fd-afb1-439e-83f5-e26cb749932f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Documentation on Template Inheritance

2018-07-29 Thread Tehem


The Template Inheritance documentation could use some more guidelines.


First,

It's not indicated in the Django Documentation that the *child *template is 
the actual view to be loaded, contrary to what its name would imply :

Template inheritance allows you to build a base “skeleton” template that 
contains all the common elements of your site and defines blocks that child 
templates can override.

The only indication of this mechanism lies in the implication that the 
system won't access ("evaluate") the parent template *first*, but only *after 
it evaluates the child template* :

When the template system evaluates this template, first it locates the 
parent – in this case, “base.html”.

I had to read a Stackoverflow question/answer to get this : django template 
extends not working 

.


Second,

The base template is not located by default in the same folder as the child 
template, as explained in the Stackoverflow question/answer : extend 
base.html problem 

.

It can be argued that while the view's render refers to 
myapp\child_template.html, it's only normal that the extends should refer 
to "myapp\base_template.html" to find it in the same directory. Except the 
documentation makes no mention of it and simply tells to extend 
"base_template.html", although in the Base tutorial, for example, it tells 
to put templates in "mysite\myapp\templates\templates\".

-- 
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/8d77c7d5-1472-4b75-8d65-4fcc1d6bd486%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Login Error

2018-07-29 Thread Kasper Laudrup

Hi,

On 2018-07-29 10:27, lalitaquasoft wrote:


How to remove Unique username



How would you expect user management to work if usernames are not unique?

Are you planning to differentiate users with identical usernames some 
other way?


Kind regards,

Kasper Laudrup

--
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/a174d423-48cf-6915-1240-aedca45b8e0f%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


File-Backend or Filemanagement

2018-07-29 Thread Muri Nicanor
Hi list,

i'm writing a Django application that has the management of textfiles on
the server as one of the requirements. I've already created a model that
parses the textfiles and provides a way of editing the files. To choose
the indivdiual textfiles i created a simple view that does a file
listing (basically an os.listdir()), but that is not really a flexible
solution (i.e. i would like to have pagination). I was wondering if it
was possible to use a ListView and use the file listing as a source of
objects instead of a database query?

Another option would be to go deeper and try to write a 'file-based'
database backend. Are there any howtos to write database backends for
Django?

thanks and cheers,
Muri

-- 
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/f7c5feda-eacf-ce7b-583b-b1e6a029deeb%40immerda.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Django App plugins

2018-07-29 Thread Ravi Kirana
Friends
Can I use django from spyder

On Sun, Jul 29, 2018 at 2:32 PM, Christian González <
christian.gonza...@nerdocs.at> wrote:

>
> anyone?
> I wondered if I'm the only one that has such a use case? Create a Django
> application with downloadable extensions of the code? How do you do the
> models/migrations?
>
> --
> 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/ef713713-d716-8ea2-78c2-e21735384cf3%40nerdocs.at.
> 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/CADDqg21FVwDHJjzxkj03vjzD%2B%2BmSADEFf2jO%3DNcp_AU6%2BDWSyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


I want to remove username unique and its validation from django i tried but not working

2018-07-29 Thread lalitaquasoft
Getting this error :I have tried to change username nul but not working

IntegrityError at /register/

UNIQUE constraint failed: superuser_user.username


please help me on this issue . It will take too much time `



-- 
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/089669f1-1f0a-41b9-9684-98363169c8ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Login Error

2018-07-29 Thread lalitaquasoft
IntegrityError at /register/

UNIQUE constraint failed: superuser_user.username 



How to remove Unique username 

-- 
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/b51548cb-dc2b-4932-94b1-8189c0a3370c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django App plugins

2018-07-29 Thread Christian González


anyone?
I wondered if I'm the only one that has such a use case? Create a Django
application with downloadable extensions of the code? How do you do the
models/migrations?

-- 
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/ef713713-d716-8ea2-78c2-e21735384cf3%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.


Re: Change the default route of a view

2018-07-29 Thread Andréas Kühne
If you are using DRF with normal URLs you just create a view that inherits
from the delete, update and retrieve mixins. Something like this should
work:

from rest_framework import generics, mixins, permissions

User = get_user_model()


class UserProfileChangeAPIView(generics.RetrieveAPIView,
   mixins.DestroyModelMixin,
   mixins.UpdateModelMixin):
permission_classes = (
permissions.IsAuthenticated,
)
serializer_class = UserProfileChangeSerializer

def get_object(self):
return self.request.user

def delete(self, request, *args, **kwargs):
return self.destroy(request, *args, **kwargs)

def put(self, request, *args, **kwargs):
return self.update(request, *args, **kwargs)


You need to import the get_user_model and the UserProdilfChangeSerializer
(or whatever you called your serializer for the profile).

Regards,

Andréas

2018-07-27 19:49 GMT+02:00 Fernando Miranda :

> Hi Andrea,
>
> So, I'm getting the user that way, I'm in doubt is how to mount the routes
> to an account view, where you have the retrieve, update and delete of the
> current user.
>
> Em sexta-feira, 27 de julho de 2018 12:23:24 UTC-3, Andréas Kühne escreveu:
>>
>> Hi Fernando,
>>
>> In DRF even with token authentication you will be able to get the
>> currently logged in user via the user object on the request. So
>> request.user will be the user doing the request.
>>
>> If you for example want to have an endpoint that is for the current user
>> you could just check the request.user to see which user is doing the
>> request. Then you don't need to use the id from the url.
>>
>> Regards,
>>
>> Andréas
>>
>> 2018-07-27 16:36 GMT+02:00 Fernando Miranda :
>>
>>> I think I understood about the rest, the right one to edit for example
>>> would be to have the route of type PUT passing the token OAuth2 in the
>>> route and there I look for the user owner of the token? Or the user ID
>>> and check if the authenticated user is the same as the last ID?
>>>
>>> Em sexta-feira, 27 de julho de 2018 08:10:19 UTC-3, Jason escreveu:

 you can probably do this with overriding a few things, but for me, your
 use case has some major problems.  you're effectively breaking away from
 the basics of REST.

 If you want to implement some sort of non-sequential identifiers for
 users/resources, use UUIDs.  Any token passed in the headers should be used
 for auth only, not contain explicit routing values.

 On Thursday, July 26, 2018 at 4:10:55 PM UTC-4, Fernando Miranda wrote:
>
> Hello, I'm using Django Rest Framework, I was wondering if you have
> how to change the default url of an endpoint in a view? In case it is
> a view of account where I wanted the retrieve method to be without / {id}
> this also for the delete and edit because I will identify the user by the
> token passed in the header.
>
 --
>>> 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/ms
>>> gid/django-users/875eb467-9cd2-492b-9aea-e311bb3da022%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/554e0c24-29d7-474a-982b-cb40838b2b14%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/CAK4qSCdTYyBXMQAkB5cVYRVh6_1Gr6Lb%2BgeumcKZMNe6cKUZig%40mail.gmail.com.
For more option