Re: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread 'Odile Lambert' via Django users
Hello If this is by design Django should raise an error indicating that ModelMultipleChoiceField does not allow an empty_label attribute The present error message in the __init__ of the super_class is not coherent and very difficult to understand for beginners.

Re: migrating from sqlite to mysql breaks the site

2019-03-14 Thread Pedram Badakhchani
Hi Anh, yes, everything works fine, the only problem is once I switched from sqlite to mysql, I am able to access the admin backend and create a post... I am able to view the list of posts created, however when I click a given post, with SQLite I can navigate to a page showing the post

Re: migrating from sqlite to mysql breaks the site

2019-03-14 Thread Ayser shuhaib
In your settings, you put the port is 3306 but in the url it’s 8000. I think the problem is there. On Thu, 14 Mar 2019 at 12:07, Pedram Badakhchani < pedrambadakhch...@gmail.com> wrote: > Hi Anh, > > yes, everything works fine, the only problem is once I switched from > sqlite to mysql, > > I am

Very much begineer

2019-03-14 Thread AhenTheBegineer
Hello, I'm very new to the software and pretty much know about python(less than basics) so I want to explore django. And want to know how it works, what software are needed for it and how do I start with the softwae to be handy with it. Thank you -- You received this message because you are

Re: Using sessions key variables as a url argument

2019-03-14 Thread Perchouli
Hi Gavin, You passed pk from URL. class TeamInfo(APIView): #... def get(self, request, pk): # Add pk to params club_pk = self.kwargs.get('pk') # get the pk #... return Response({ 'club_pk': club_pk }) Will pass

image didn't upload

2019-03-14 Thread omar ahmed
this is my model class LeagueNews(models.Model): ... news_image = models.ImageField(upload_to='core/media/core',max_length=255, null=True,blank=True) and this is my template {% block content %} {{ article.news_title }} {{ article.publication_date }} {{ article.news_text }} {% endblock

Re: Very much begineer

2019-03-14 Thread Chetan Ganji
Look no further codingforentrepreneurs Start with trydjango 1.8 project. See his youtube channel. Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in

Re: image didn't upload

2019-03-14 Thread Chetan Ganji
Did you setup MEDIA-ROOT location in your settings.py For reference - https://docs.djangoproject.com/en/2.1/ref/settings/#media-root Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in

Re: migrating from sqlite to mysql breaks the site

2019-03-14 Thread Anh Nguyen
I see 2 ways to handle. 1: would you want to try postgresql ?, if this get the same trouble. We got the big problems. 2: try to create a blank project start from django-admin ... it’s not greater then 20mins. On Thu, Mar 14, 2019 at 5:26 PM Ayser shuhaib wrote: > In your settings, you put the

RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread Matthew Pava
Well, it is raising an error. It’s a Python error. Basically, you were passing a keyword argument (empty_label), and the class was passing the same keyword argument called empty_label. Expanded out, this is what was happening: field = forms.ModelMultipleChoiceField( queryset =

on_delete not getting called when ForeignKey is a property

2019-03-14 Thread mccc
Hello, I have set up this nice model: class CustomGroup(models.Model): name = models.CharField(max_length=255) _parent = models.ForeignKey( "self", on_delete=models.CASCADE, null=True, related_name="descendants", db_column="parent" ) _depth =

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-14 Thread drone4four
I’ve discovered a ‘hack’ to correct the issue. I committed and pushed my changes up to my GitHub repo for those curious enough to try it out yourself. My problem now is that I don’t really understand why it works. Here I will explain what I do know and then my ask would be for you people to

Re: image didn't upload

2019-03-14 Thread Chetan Ganji
See this works or not. # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] MEDIAFILES_DIRS = [ os.path.join(BASE_DIR, 'media'), ]

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-14 Thread Ahmed Ishtiaque
When a user requests your home page's URL the first time in order to load your home.html file, the GET request they send to your server does not contain the 'ccEntry' parameter, which raised the MultiValueDictKeyError whenever your view was executing. However, in your edited view, you take care of

Re: image didn't upload

2019-03-14 Thread omar ahmed
thanks but it doesn't work MEDIA_URL = '/media/' MEDIA_ROOT = 'media' On Thursday, March 14, 2019 at 2:36:35 PM UTC+2, Chetan Ganji wrote: > > Did you setup MEDIA-ROOT location in your settings.py > For reference - > https://docs.djangoproject.com/en/2.1/ref/settings/#media-root > > Regards, >

LDAP autentication do not protect my site

2019-03-14 Thread emmanuel . ferro
Hi every one, My ldap login is not protect my site. One can access just typing a url. What is wrong? These site is just a set of html templates. --- settings.py --- AUTH_LDAP_SERVER_URI = "ldap://ldap.city.company; AUTH_LDAP_BIND_DN =

Re: image didn't upload

2019-03-14 Thread AbsolutEdge findout
Hello omar, I don't see that you're uploading the picture anywhere, you haven't used a form to upload the image, your template is just trying to display the image, where are the views? and where's the form by which you uploaded the image? Post all of these please. Thanks, Majid -- You

Re: on_delete not getting called when ForeignKey is a property

2019-03-14 Thread Chetan Ganji
That approach is not working for the original poster. So I gave him a solution that solves the problem. I meant, its my opinion to keep models slim and write utils to make the controllers slim. You don't have to follow it ;-) Follow what makes sense to you. I prefer it that way. Regards,

Re: on_delete not getting called when ForeignKey is a property

2019-03-14 Thread mccc
On Thursday, March 14, 2019 at 4:22:15 PM UTC+1, Chetan Ganji wrote: > > Why do you need to do any calculations in the model code? > > I would do any calculations in the views and store them using models. That > will remove the getters and setters from model. > Everything should work fine

Re: image didn't upload

2019-03-14 Thread omar ahmed
i want to post image in news page On Thursday, March 14, 2019 at 6:26:26 PM UTC+2, AbsolutEdge findout wrote: > > Hello omar, > > I don't see that you're uploading the picture anywhere, you haven't used a > form to upload the image, your template is just trying to display the > image, where are

Re: on_delete not getting called when ForeignKey is a property

2019-03-14 Thread Sithembewena L. Dube
There is nothing wrong with having logic in models. This is the principle of object orientation - encapsulating methods and properties in a class definition to group related behaviours and attributes of a specified type of entity. See the section titled "Make ‘em Fat" here:

Re: on_delete not getting called when ForeignKey is a property

2019-03-14 Thread Chetan Ganji
OK. One work around could be to fire the signal manually just after you set/delete the value? I have not checked it yet :P Do one thing, implement pre_delete and post_delete signals and check the values of instance, sender and using. It might give you more information about what is happening.

Re: on_delete not getting called when ForeignKey is a property

2019-03-14 Thread Chetan Ganji
Why do you need to do any calculations in the model code? I would do any calculations in the views and store them using models. That will remove the getters and setters from model. Everything should work fine then. Hope it helps. Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com

Re: Generic CBV DeleteView GET csrf_token

2019-03-14 Thread B
Thanks. I have things working fine under Ajax. This particular scenario is an "odd one" since performing a GET on a delete view isn't common, but it is implemented by Django. It is helpful for testing, but perhaps the right approach is to "disable" get for the DeleteView and be done with it. My

Generic CBV DeleteView GET csrf_token

2019-03-14 Thread B
I'm implementing a DeleteView, and for completion I would like to provide the functionality indicated here: https://docs.djangoproject.com/en/2.1/ref/class-based-views/generic-editing/#deleteview *If this view is fetched via GET, it will display a confirmation page that should contain a form

Re: Generic CBV DeleteView GET csrf_token

2019-03-14 Thread Chetan Ganji
Frameworks dont work as we want them too :P We have to understand how the defaults are implemented then make the changes as necessary ;-) If it can be customized, great! otherwise learn and use a different framework, LOLZ ;-) Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com

Re: Generic CBV DeleteView GET csrf_token

2019-03-14 Thread Chetan Ganji
https://www.django-rest-framework.org/topics/ajax-csrf-cors/ https://docs.djangoproject.com/en/2.1/ref/csrf/#ajax Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in

error information in Django forms template

2019-03-14 Thread Mike Rankin
I'm new to Django and I'm trying an experiment using material.io. The problem I'm having is that the formfield injects the error messages and the label directly into the page instead of sending it to the widget template. Because of the way material.io builds controls, it would be nice to have

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-14 Thread drone4four
Thank you Ahmed for this clarification. This makes sense. I have two further questions for you (or anyone else still reading this thread): 1. Is there a way of checking for the presence of the data with GET which is more Pythonic and aligns with better practices? 1.

Re: What step am I missing?

2019-03-14 Thread Joseph Jones
Hi, yes Thank you so much those video tutorial helped me quite a bit. I was able to create a new directory, as the "introduction to django" tutorial suggested I've made sure its title is project specific. However, I seem to have run into a problem creating a path to my new directory. when last I

Re: Looking for a Django co-founder

2019-03-14 Thread Harish Chaudhary
Hello Zack Good to see your post, Do you want experienced developer or fresher will also do?? On Fri, 15 Mar, 2019, 9:11 AM Zack Amaral, wrote: > Django users, > > I'm looking for a Django developer that can commit to working 10 hours a > week on the weekend. We work Friday and Saturday at 12AM

Looking for a Django co-founder

2019-03-14 Thread Zack Amaral
Django users, I'm looking for a Django developer that can commit to working 10 hours a week on the weekend. We work Friday and Saturday at 12AM EST. I'm looking to bring on another developer that's willing to work for equity in my company. We are building a web application similar to

Re: Looking for a Django co-founder

2019-03-14 Thread Zack Amaral
Harish, I need an experienced developer. On Thu, Mar 14, 2019 at 10:52 PM Harish Chaudhary wrote: > Hello Zack > Good to see your post, > Do you want experienced developer or fresher will also do?? > > On Fri, 15 Mar, 2019, 9:11 AM Zack Amaral, > wrote: > >> Django users, >> >> I'm looking for

Looking for a Django co-founder

2019-03-14 Thread Deepak sharma
Hi Zack, find me on finddeepak.com Good to connect with you on this. -- 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

Re: Looking for a Django co-founder

2019-03-14 Thread Anh Nguyen
Hi Zack, it’s good to see your post. Now I think i can do that. You can check my own blog and production in ‘adaoalive.com’ and ‘chuthe.com ’. Thanks. On Fri, Mar 15, 2019 at 10:41 AM Zack Amaral wrote: > Django users, > > I'm looking for a Django developer that can commit to working 10 hours a

Re: Why use CustomUserManager.create_user and not CustomUserManager.create?

2019-03-14 Thread Peter of the Norse
The biggest difference is that when you call create_user, it creates a hash of the password. Eventually, create_user does call create, but only after setting all the values properly. Sent from my iPad > On Feb 17, 2019, at 4:30 AM, Maarten Nieber wrote: > > Hi, > > the Django guidelines