Re: How to get two django rest framework to communicate with each other

2018-01-15 Thread Mohammad Etemaddar
Excuse me for giving advice for this change. But why don't you put these two projects in one Django project as two apps? You have two options. First you can make a ManyToMany relationship. Of course this has a problem. For example some people may not want to share his/her future information to a

Adding default rows to Django admin inlines

2019-01-19 Thread Mohammad Etemaddar
If I get you right you need to add m2m objects with a default value. In this situation, you can create an intermediate model to build m2m. For example: JobActionRel: job = fk action = fk-to-actions (default=Action.objects.get...) And use it as through model: https://docs.djangoproject.com/en/2.1/t

submit button redirecting to unknown url

2019-01-20 Thread Mohammad Etemaddar
Change action="." To action="" -- 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 dj

Best Learning Resources

2019-01-20 Thread Mohammad Etemaddar
I liked "django by example" -- 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 djang

Access to the last object of model inside model itself

2019-01-25 Thread Mohammad Etemaddar
Hello I need the last object of model inside it. for example I have: class Field(models.Model): category = models.ForeignKey(Category, related_name='fields', on_delete= models.CASCADE, default = get_last_factory_field_category()) def get_last_factory_field_category(): return Field.objects.last().c

Re: Access to the last object of model inside model itself

2019-01-26 Thread Mohammad Etemaddar
Im not agree. Managers are created for custom query. But here the query is last. I think I got the philosophy. The default value should not be a manager, because the database does not understand it. Maybe I am wrong! -- You received this message because you are subscribed to the Google Groups "

Re: Access to the last object of model inside model itself

2019-01-26 Thread Mohammad Etemaddar
I commented out the default value and then ran the makemigrations again, and then uncommented again and worked. Of course by lambda. -- 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 i

forms with get_or_create and inlineformset_factory

2019-01-26 Thread Mohammad Etemaddar
I think the answer is in your signal-connected function in your question query which you choosed all() questions. I did not understand the project, but you should choose questions in signal and not all questions I think. -- You received this message because you are subscribed to the Google Grou

Re: Django, mod_wsgi and apache2.4 = 403 forbidden

2019-01-29 Thread Mohammad Etemaddar
I have no experience in configure apache. But these two lines have conflict. DocumentRoot C:\Frontier_Website\FATWebsite\FrontierWebApp\zigview\templates\FrounterWeb and: WSGIScriptAlias / C:\Frontier_Website\FATWebsite\FrontierWebApp\FrounterWeb\wsgi.py Both of these lines tell apache

update object without updating auto_now fields

2019-02-13 Thread Mohammad Etemaddar
I think about times that I need to edit user profiles without touching auto_now field. How can I do it? -- 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-u

Re: Passing values

2019-02-13 Thread Mohammad Etemaddar
Dear Ivan, If I get you right, You have a page with form, and you want to post it to another page. so, fill the "action" part of html form with the second page's url. Also the timezone.now is allways available in any python file you are working on it, and also request and request.user What do

Crispy: Helper Layout has no effect on form.

2019-03-20 Thread Mohammad Etemaddar
Here is my model form which is rendered by crispy. When I change the layout, ordering, or adding elements, has no effect on rendered form. Do you see any problem in the code? Thank you class FactoryForm(forms.ModelForm): class Meta: model = Factory fields = ('name','field', 'description', 'man

Re: 404 error when posting a multipart/form-data form

2019-03-21 Thread Mohammad Etemaddar
Can you send your view here? On Thu, 21 Mar 2019 12:58 Manlio Perillo, wrote: > I have a Django application that works perfectly fine both on my PC and on > a hosting system with CloudLinux and Passenger. > However when I added a form with a file field, I started to get 404 errors > on POST. > >

Re: log out a user when user closes tab or browser

2019-03-21 Thread Mohammad Etemaddar
I have a suggest for you. Its non standard. First create a javascript infinite loop to make a get call every 1 minute. Also make session expiration time at 2 minutes. So if tabs closed the session will expire at 1 minute. On Thu, 21 Mar 2019 15:17 Christian Ledermann, < christian.lederm...@gmail.

Re: 404 error while loading uploaded image when debug is False

2019-03-21 Thread Mohammad Etemaddar
In production , we serve static files (like images) stright from httpd like apache, and we do not call django to serve them. But in testing while run django test server, we use static paths in urls.py to serve them, Maybe you have added mediaurls to your urlpatterns in urls.py conditionally (when

Re: 404 error when posting a multipart/form-data form

2019-03-22 Thread Mohammad Etemaddar
I'm not sure about this, but I think maybe it would be about your Django bug. Have you updated your Django? On Friday, March 22, 2019 at 7:37:14 PM UTC+4:30, Manlio Perillo wrote: > > On Friday, March 22, 2019 at 3:23:32 PM UTC+1, Manlio Perillo wrote: >> >> On Friday, March 22, 2019 at 1:28:55 P

Re: is_valid() method and cleaned_data attribute

2019-03-22 Thread Mohammad Etemaddar
Every field in Form has validators which check the value against their conditions. as Django Doc sais : The primary task of a Form object is

Re: Crispy: Helper Layout has no effect on form.

2019-03-26 Thread Mohammad Etemaddar
Found the answer. I used crispy like this: {{ form|crispy }} *But We should use like this to get form helper effect:* {% crispy form %} On Wednesday, March 20, 2019 at 7:02:31 PM UTC+3:30, Mohammad Etemaddar wrote: > Here is my model form which is rendered by crispy. > When I chan

Re: Django 2.7.1 - "TemplateDoesNotExist at /munichlivingapp/seekers/ "

2019-03-30 Thread Mohammad Etemaddar
Dear Kabiba, It would be good to post your code (specially the part that renders the template). I think you're addressing the template by 'seeker_list.html'. You need to specify the mother directory 'munichi...app/seeker_list.html'. or put seeker_list.html right inside the templates directory. On

Login by phone number best practice

2019-04-03 Thread Mohammad Etemaddar
I want users to login by phone number (without registration). But we need username field for authentication. This is just for make easy for users that don't know about using email. And also make it easier to login for them. But I need also username and email for other users for future. I need you

I need help on adding a search button to an input field

2019-04-03 Thread Mohammad Etemaddar
You can use FieldWithButtons in form helper's layout: https://django-crispy-forms.readthedocs.io/en/d-0/layouts.html -- 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

RE: Login by phone number best practice

2019-04-03 Thread Mohammad Etemaddar
Thank you. But django-phone-login seems a bit complex. It uses rest framework. I don't know why. -- 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+un

Re: Using forms to handle request.GET data?

2019-04-03 Thread Mohammad Etemaddar
Set default value: year = forms.ChoiceField(required=False, choices=[(j, j) for j in range(2018, 2021)], default=2019) You do not need clean_year any more I think. On Wednesday, April 3, 2019 at 1:42:50 AM UTC+4:30, Carsten Fuchs wrote: > Dear Django group, > > I would like to show users a form

Why my email goes to spam?

2019-04-18 Thread Mohammad Etemaddar
Hello. I'm working on a bussiness website. I send invitation and also confirm emails by django-allauth. Invitation and allauth emails go to spam box. I don't know what is the problem? How can I prevent emails going to spam? -- You received this message because you are subscribed to the Google Gr

Re: Why my email goes to spam?

2019-04-19 Thread Mohammad Etemaddar
> > Hi Mohammad, > > On 18/04/2019 10.05, Mohammad Etemaddar wrote: > > Hello. I'm working on a bussiness website. I send invitation and also > > confirm emails by django-allauth. > > Invitation and allauth emails go to spam box. > > I don't know wh

Re: models

2019-05-08 Thread Mohammad Etemaddar
The one who should have foreign key is is filter, box and barel to shelf. Then you can access them from shelf: Shelf0.boxs Shelf0.barels And shelf0.filters Note that you can set the relation_name in foreign key so that you can use the related name instead of filters, boxs and barels On Wed, 8 May

Confused with deleted migrations

2019-06-12 Thread Mohammad Etemaddar
Hey folks After uploading the app to the server, I got problems by local migrations in development. So deleted the migrations and local sqlite db (Server uses MySQL). After more development, uploaded the whole project to the server and overwrite the files. And typed migrate on server. I don't kn

Re: Confused with deleted migrations

2019-06-16 Thread Mohammad Etemaddar
+4:30, Mohammad Etemaddar wrote: > > Hey folks > After uploading the app to the server, I got problems by local migrations > in development. So deleted the migrations and local sqlite db (Server uses > MySQL). > After more development, uploaded the whole project to the server and

Strongly Want to Eat Django

2019-06-16 Thread Mohammad Etemaddar
https://metemaddar.ir/?p=24 -- 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+un

Fresh Django with mod_wsgi and apache goes Time Out on 18.04

2018-07-07 Thread Mohammad Etemaddar
I have installed Ubuntu server 18.04 and *VirtualMin* on it. installed python3-pip and then virtualenv. Also installed *libapache2-mod-wsgi-py3* Created new virtual server and configured the modwsgi for it. Also created fresh django website for it. But I get Timeout error! Here is my apache config