Re: Invalid pk \"1\" - object does not exist.

2019-02-25 Thread Phako Perez
I guess you need to define first the id in models.CASCADE, 

When you try to insert as per your table definition it looks for the key on 
that table

> manager = models.ForeignKey('self', null=True, 
> related_name='employee',on_delete=models.CASCADE)
Hope this can be helpful 

Happy coding!!!
Sent from my iPhone

> On Feb 25, 2019, at 7:36 AM, optvisi...@gmail.com wrote:
> 
> getting error
> 
> 
> {"manager":["Invalid pk \"1\" - object does not exist."]}
> 
> 
> here is my model class
> 
> class Employee(models.Model):
> 
> MANAGER = 'MGR'
> STANDARD = 'STD'
> 
> 
> EMPLOYEE_TYPES = (
> 
> (MANAGER, 'manager'),
> (STANDARD, 'employee')
> 
> )
> 
> 
> role = models.CharField(max_length=25, choices=EMPLOYEE_TYPES)
> name = models.CharField(max_length=100, null=True, blank=True)
> employee_id = models.CharField(max_length=100, null=True, blank=True)
> manager = models.ForeignKey('self', null=True, 
> related_name='employee',on_delete=models.CASCADE)
> 
> 
> and json data which i am using to save in table
> 
> {
>   "role":"MGR",
>   "name":"John",
>   "employee_id" :"IN",
>   "manager":1
>   
>   }
> 
> 
> 
> 
> -- 
> 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/454e6708-d6f6-43ee-8542-85d92a69d1cd%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/CF0263A3-5575-4CFF-A778-D2482DD8DB76%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tag block and endblock

2019-02-25 Thread Phako Perez
If you see at the beginning of your template it loads/import another file which 
actually contains the part of code which goes in there, this block has same 
name like myBlock.

Hope this is helpful 

Happy coding!

Sent from my iPhone

> On Feb 25, 2019, at 4:06 PM, Nexx  wrote:
> 
> Wht is the purpose of the tag 
> {% block myBlock %}
> I red the document but i don't underatand.
> 
> -- 
> 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/7c8648e8-bf1a-4803-99f8-92c3a9064ae9%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/03355482-F296-4026-A8A5-70992052E0F0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError: attempted relative import beyond top-level package

2019-03-02 Thread Phako Perez
I guess you miss the __init__.py file in project1 directory


Sent from my iPhone

> On Mar 2, 2019, at 3:25 PM, Bulgarian seller  wrote:
> 
> from ..appTwo import views
> urlpatterns = [
> path('',views.index),
> path('admin/', admin.site.urls),
> ]
> 
>  
> ValueError: attempted relative import beyond top-level package
> How to fix it in django?
> I have this in AppTwo.views  
> def index(request):
> return HttpResponse("My Second Project")
> 
> 
> 
> 
> -- 
> 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/66c7e5ce-fafc-45d7-aa75-3a0ffb499ed5%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/DB9D0FE4-0FC0-4924-BB02-C950CC21B120%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: test if model object fits into QuerySet without executing SQL?

2019-03-15 Thread Phako Perez
You can create query as

def get_query(value=None):
if value:
  query = “select all records from table where color = ‘" + value + “‘
  query = “select all records from table”

return query

Sent from my iPhone

> On Mar 15, 2019, at 6:20 AM, jgib...@caktusgroup.com wrote:
> 
> Tom,
> 
> Could you clarify "fits into"?
> 
> qs1 = Table.objects.all()
> qs2 = Table.objects.filter(color='blue')
> 
> 
> mo1 = qs1[0]
> 
> 
> Are you trying to determine if mo1 is in qs2?
> 
> Best
> 
>> On Friday, March 15, 2019 at 7:46:14 AM UTC-4, Thomas Klopf wrote:
>> Hi all,
>>   Please I have a question, couldn't find any answer for it..
>> 
>>   Let's say I have 2 QuerySets:
>>   1) Select all records from table
>>   2) Select all records from table where color = "blue"
>> 
>> So QuerySet #2 is more restricted than QuerySet #1
>> 
>> So question is - if I get a model object from QuerySet #1, is it possible to 
>> check if the model object is 'filtered'  or fits into QuerySet #2, without 
>> actually executing the SQL for QuerySet #2 to find the record again?
>> 
>> I'm asking because running the SQL for QuerySet #2 is expensive, ideally 
>> would test if the record fits into the QuerySet in purely python/django.
>> 
>> Thanks in advance!
>> Tom
>> 
> 
> -- 
> 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/26c692ef-6e97-4fa2-b5ef-6ebb24e408cb%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/2A56D6F6-0AC6-4463-8887-F291E5915A9A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1054, "Unknown column 'userprofile_user.phone' in 'field list'"

2019-03-27 Thread Phako Perez
Review your model, seems you missed add phone into your model or some 
misspelling 

Sent from my iPhone

> On Mar 27, 2019, at 12:05 AM, Pinkesh Narad  
> wrote:
> 
> hello all,
> I am new to this, and i am getting this error and unable to run my admin 
> as of I did makemigration app-name also delete my migrations several time but 
> still getting same error and i am stuck here. 
> please help me 
> -- 
> 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/4c5c5b76-d677-4323-97de-76246aacb9f9%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/8E7E1BB1-4053-4C0F-AD2E-C5EDD277C000%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Phako Perez
Isn’t required, it depends on you as PyCharm has more functionalities 

Sent from my iPhone

> On Mar 27, 2019, at 12:49 PM, goodresults  wrote:
> 
> --
> -- 
> 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/337bb1f9-3880-41b9-8e60-5786ec14743c%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/6B05757A-741F-4C00-B4A2-35912CE5E361%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ayuda con el error: UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 7: ordinal not in range(128)

2019-05-07 Thread Phako Perez
Al parecer estás usando un carácter como ñ o ç, el cual es de los extendidos, 
supongo intentas settear el password o el nombre de usuario, intenta con puro 
carácter sin acentos o tilde ni ninguna otra forma rara.

Sent from my iPhone

> On May 7, 2019, at 16:21, noel moreira  wrote:
> 
> Hola amigos, me podrían ayudar aresolver este error:
> 
> UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 
> 7: ordinal not in range(128)}
> 
> Esto me paso cuando estaba creando el super usuario en django
> 
> -- 
> 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/0e0d233e-b0d5-4253-aa21-343ef48518b8%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/E9963FCD-DB44-4454-9D89-FA8132EEDFA3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need urgent help on Django project

2019-05-10 Thread Phako Perez
You could use a dictionary with cities as keys and in first drop down get keys 
and an if condition for second where it checks first for city if nothing 
selected then make second disable

Sent from my iPhone

> On May 10, 2019, at 07:35, avdesh sharma  wrote:
> 
> Hi Django Users,
> 
> 
> I have a registration form in which I wanted to enter only Indian Cities in 
> one fields as a dropdown and their respective states in another field 
> dropdown.
> Could you please help me and provide me step by step guidance how to achieve 
> that as I am an intermediate level programmer.
> 
> 
> Thanks in advance !
> 
> -- 
> Warm Regards,
> Avdesh Kumar Sharma
> 9650031844
> -- 
> 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/CAF5Nfo4c8%2Bcj6yDzOE9eAWqoRH_7OA5TUo14FL9SEZhJem%2BXuA%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/7EA1C65E-3786-4A9F-962F-6B1B6DECFB9D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running tests creates many unnecessary files

2019-06-28 Thread Phako Perez
As per my understanding all test runs in a virtual environment and all 
data(files, variables databases) are deleted once test clmpletes, how are you 
running these test, are you using a specific library from python or using own 
tests in a personal file?

Sent from my iPhone

> On Jun 28, 2019, at 08:43, אורי  wrote:
> 
> Hi,
> 
> I found out that in the directory media of Speedy Net 
> (https://github.com/speedy-net/speedy-net) on my computer, there are more 
> than 200,000 unnecessary files and more than 20,000 folders. I checked the 
> time the files were created and it seems that they were created because I ran 
> Django tests locally. Why are so many files and folders created and remain 
> undeleted after the tests end? I would expect all the temporary files to be 
> deleted when the tests end. We have many tests (I think more than 1,000 tests 
> - https://travis-ci.org/speedy-net/speedy-net/builds/551457609) and I ran 
> them many times but I didn't expect so many unnecessary files to be created 
> on my computer. Is there something I can do to prevent it?
> 
> I just ran all the tests locally now, after I deleted all the previous files 
> and folder in media, and I found out that 903 files and 1,041 folders were 
> created. I'm not sure which of our tests created these files and folders. 
> Most of these files are either .jpg or .dat files. Is it possible to delete 
> all these files automatically after the tests end?
> 
> Thanks,
> אורי
> u...@speedy.net
> -- 
> 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/CABD5YeF9JbEVNz_XvGrSTqjR%3Dj9mWkP3pdYf%2BiET3yzm%2B9j59w%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/BB769359-933B-4570-B24B-819031E9DBB6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem

2020-03-16 Thread Phako Perez
What’s the problem???

Using python 3 you can create an environment as

python3 -m venv my_env

Kindly send an error or what is the issue you face while trying to create the 
env, so will be more easy to help, otherwise this question you can search on 
google for a beginner tutorial

Regards

Sent from my iPhone

> On 16 Mar 2020, at 13:34, Daniel Chiemelu  
> wrote:
> 
> 
> Please I am new in Django and I am finding it difficult to create a virtual 
> environment and also install Django and I had a virtual environment that I 
> created before using Flask
>  
> Sent from Mail for Windows 10
>  
> 
>   Virus-free. www.avast.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5e6fd482.1c69fb81.b9f97.42e4%40mx.google.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84A00726-EAF0-4D71-9CB6-2B9A0BD63184%40gmail.com.


Re: Problem

2020-03-16 Thread Phako Perez
Once you created the venv, you will get a new directory, (with the name you 
provided in this example my_env)
In Linux you can activate as

source my_env/bin/activate

You will notice your prompt change with the venv name at the beginning 

Now you are on your venv

pip list

Will list all the libraries installed, now you can simple install as usual

pip install 

Regards

Sent from my iPhone

> On 16 Mar 2020, at 13:59, Daniel Chiemelu  
> wrote:
> 
> 
> So after creating the virtual environment what is next on installing django
>  
> Sent from Mail for Windows 10
>  
> From: Phako Perez
> Sent: Monday, March 16, 2020 8:42 PM
> Subject: Re: Problem
>  
> What’s the problem???
>  
> Using python 3 you can create an environment as
>  
> python3 -m venv my_env
>  
> Kindly send an error or what is the issue you face while trying to create the 
> env, so will be more easy to help, otherwise this question you can search on 
> google for a beginner tutorial
>  
> Regards
> 
> Sent from my iPhone
> 
> 
> On 16 Mar 2020, at 13:34, Daniel Chiemelu  
> wrote:
> 
> 
> Please I am new in Django and I am finding it difficult to create a virtual 
> environment and also install Django and I had a virtual environment that I 
> created before using Flask
>  
> Sent from Mail for Windows 10
>  
>  
> 
> Virus-free. www.avast.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5e6fd482.1c69fb81.b9f97.42e4%40mx.google.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/84A00726-EAF0-4D71-9CB6-2B9A0BD63184%40gmail.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5e6fda79.1c69fb81.ee8e8.440a%40mx.google.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80DD347A-A65E-443F-A75D-511F4B072C6C%40gmail.com.


Re: Django framework on Windows OS

2020-03-17 Thread Phako Perez
May I suggest use an IDE as pycharm, there is a terminal available inside IDE, 
where all the environment is setup already and you don’t need to modify 
anything else but the interpreter to use

Regards

Sent from my iPhone

> On 17 Mar 2020, at 19:35, chucks ogwo  wrote:
> 
> 
> Does anyone here use Django on windows? Cos I have been having a series of 
> errors since I started using Django on Windows, even while using the windows 
> commands and it has really stunted my learning process of the framework
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/b61cb0a4-4145-4a87-a4fc-dc9c93cd9a5b%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/460BA09B-F6D9-4553-BB62-C0AE58FC0BB5%40gmail.com.


Re: What is the difference between virtual environment and normal code in pycharm

2020-03-19 Thread Phako Perez
Hi Ravi,

There is no difference, both works same, however when you use the virtual 
environment, all the package you install will be available only in that venv, 
so you can create an environment per project and each project will have their 
own package list, each with their own version.

On the other hand, normal code you can install any package your projects needs, 
but all will works with same version, if you face a project needs to downgrade 
the version package N, you may face issues with the others projects as this 
will affect directly.

Regards 

Sent from my iPhone

> On 19 Mar 2020, at 7:13, Ravi Prakash  wrote:
> 
> 
> Hi All
> 
> What is the difference between the virtual environment and normal code in 
> pycharm?
> 
> Can you explain, please
> 
> 
> Virtual Clone
> VirtualTech Outsourcing Services Pvt Ltd 
> 59/B, Plot No. 4, 5 and 6, Nehru Nagar (West)
> Bhilai, Chhattisgarh - 490 020, India
> www.virtualclone.in
> 
> 
> LEGAL DISCLAIMER: The contents of this electronic communication and any 
> attached documents are strictly confidential and they may not be used or 
> disclosed by someone who is not a named recipient.
> 
> If you have received this electronic communication in error please notify the 
> sender by replying to this electronic communication inserting the word 
> "misdirected" as the subject and delete this communication from your system.
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/f71b0415-e137-4b02-b3d5-a3ecc644be09%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/569C72CA-BC31-405F-BD77-B5DAE849456A%40gmail.com.


Re: Looking for Django developers to work on a new and an existing project with our team

2020-03-29 Thread Phako Perez
Hi,

I’m also interested to join your team, have 3+ years working with python 
Currently I’m teaching python to a group in order them to improve theirs career 

Thanks in advance 

Sent from my iPhone

> On 29 Mar 2020, at 20:48, chinna  wrote:
> 
> 
> Hi,
> 
> I am Premkumar having 3 years of experience in web and rest api development 
> using python and Django. I would like to join your team
> 
>> On Sun, Mar 29, 2020 at 11:26 PM Lax Nayak  wrote:
>> I am looking for a django developer who has expertise in building enterprise 
>> grade solutions. 
>> 
>> 
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f93f06b0-883c-4477-9d73-cc429a43380d%40googlegroups.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAG%3DmdoCaGy%3DTWh0CY04_TBo8uG__4UWnd8sfWYLOZ8fapfZ%3DCA%40mail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5C30197E-FCE7-4BE8-B169-4E9E74F4EBF3%40gmail.com.


Re: In pycharm errror

2020-04-09 Thread Phako Perez
Check the ‘ls’ command to verify is on directory you are running the manage.py

And not sure about how you ran the command, but you should run as

python manage.py runserver 

Regards

Sent from my iPhone

> On 9 Apr 2020, at 9:25, tejasri mamidi  wrote:
> 
> While executing py manage.py runserver ..
> Terminal showing this file will not found 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/c78171f3-b6f3-4f74-9cd1-a8c2a3b52d3d%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8AD8B671-4B36-4291-9352-0461CCADC872%40gmail.com.


Re: AttributeError

2020-04-27 Thread Phako Perez
I think issue is how you are trying to access the attribute
This is a form and must be accessed through a post call.

Can you share your html form???

Sent from my iPhone

> On 27 Apr 2020, at 10:29, DimGo  wrote:
> 
> 
> from django import forms
> from django.core.exceptions import ValidationError
> 
> class SearchProduct(forms.Form):
>  text=forms.CharField(label='Search ')
>  date=forms.DateField(required=False)
>  
> t = SearchProduct()
> print(t.date)
> 
> Error: 
> 
> AttributeError: 'SearchProduct' object has no attribute 'date'
> 
> 
> 
> why is there this error? How to fix it? 
> 
> ff
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/445e0ffb-03e7-4a32-9d83-b48795a9866c%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6FEB0B14-73FF-4A74-80B4-ED982F95D01F%40gmail.com.


Re: AttributeError with forms

2020-04-27 Thread Phako Perez
In addition, you must define your model in models.py

And to get this attributes on your views.py from a post request, you could use 
like {{ form.attribute }}

Regards

Sent from my iPhone

> On 27 Apr 2020, at 10:29, DimGo  wrote:
> 
> 
> Why is this this strange error? 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com.
> <Снимок экрана от 2020-04-27 18-06-28.png>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A6EAD9A6-59B3-4986-8338-DF0A5DFDF2F7%40gmail.com.


Re: Create a function which fill automatically a field in my models

2020-05-07 Thread Phako Perez
You can use default option while creating model

Sent from my iPhone

> On 7 May 2020, at 8:53, Derek  wrote:
> 
> 
> Its unclear what you mean by "last ID" - and I cannot see the value of 
> storing such as they are available in the database...
> 
> But have a look at 
> https://stackoverflow.com/questions/12649659/how-to-set-a-django-model-fields-default-value-to-a-function-call-callable-e
>  
> 
> The example is:
> 
> from datetime import datetime, timedelta
> 
> # default to 1 day from now
> def get_default_my_date():
> return datetime.now() + timedelta(days=1)
> 
> class MyModel(models.Model):
> my_date = models.DateTimeField(default=get_default_my_date)
> 
> 
> Instead of the date arithmetic, you'd need to write code to, for example, 
> extract last ID from the database (assuming you have an auto-increment ID 
> set) and do the concatenation.
> 
> 
> 
> 
>> On Thursday, 7 May 2020 02:23:22 UTC+2, Anselme SERI wrote:
>> Thanks you for your answer. I know how to make a default value in charfield 
>> but I don't know  how to build function which returns value for my default 
>> field. In my case this function must retrieve last id on my model and must 
>> concataned it with a string and the final result must be affected to default 
>> charfield. Have you an example ? Help me plz.
>> 
>>> Le mer. 6 mai 2020 à 18:44, Motaz Hejaze  a écrit :
>>> Yes you can make a normal charfield and assign its default attribute to a 
>>> function you declare
>>> 
 On Wed, 6 May 2020, 6:53 pm Anselme SERI,  wrote:
 Hi,
 
 I use Django 3.0 and I would like to create a function which fill 
 automatically a field in my models.
 Can I do it directly in models.py ? How?
 
 Thanks a lot
 
 -- 
 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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/5f810453-c7ca-4c10-bca1-4cfe11ea496a%40googlegroups.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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAHV4E-dDRD%3DLteuDo7KuATzjKem-ThvtozzHuaqkwAeAC%2BBrZw%40mail.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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/48c4d59e-8241-4739-b8df-feab45a7fa3a%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/B80CE7F3-311A-4F57-8DB0-9B80997DEAC4%40gmail.com.


Re: I can't see my models in MySQL db

2018-07-06 Thread Phako Perez
Hi Azimzadeh,

I’m also new in Django but I notice you referred to app as django-sb-admin and 
you added in settings as django_sb_admin

Just want to point the mismatch in name, your app is with ‘-‘ whereas installed 
apps has ‘_’, issue could be this mismatch? As python itself is key sensitive 

Regards

Sent from my iPhone

> On Jul 5, 2018, at 9:55 PM, A. Azimzadeh  wrote:
> 
> Hi Julio,
> Thanks for reply to my question.
> 
> I created models for django-sb-admin (As default, models.py of djangosbadmin 
> is empty + there isn't the name of app in INSTALLED APPS +).
> 
> 
> are you sure the INSTALLED_APPS shouldn't be simply 'django_sb_admin' instead 
> of 'django_sb_admin.apps.DjangoSbAdminConfig'?.
> 
> Yes, because I'm following tutorials-section of django 2.0 (models 
> tutorial/section(activating models)):
> 
> https://docs.djangoproject.com/en/2.0/intro/tutorial02/
> 
> How to find the root cause of problem :(??!! 
> 
> Tnx in advance
> 
>> On Thu, Jul 5, 2018, 23:53 Julio Biason  wrote:
>> Hi Azimzadeh,
>> 
>> Just wondering, is django_db_admin this one 
>> https://github.com/bluszcz/django-sb-admin ? 'Cause that app doesn't have 
>> any models (it's empty 
>> https://github.com/bluszcz/django-sb-admin/blob/master/django_sb_admin/models.py),
>>  so it shouldn't create any tables.
>> 
>> Also, are you sure the INSTALLED_APPS shouldn't be simply 'django_sb_admin' 
>> instead of 'django_sb_admin.apps.DjangoSbAdminConfig'? Remember, you should 
>> point to APPS, not to CLASSES...
>> 
>>> On Thu, Jul 5, 2018 at 4:13 PM, A. Azimzadeh  
>>> wrote:
>>> Hi again,
>>> 
>>> Any help !??
>>> Please help me to find and fix the root cause of problem.
>>> 
>>> Thanks
>>> 
 On Wed, Jul 4, 2018, 22:57 A. Azimzadeh  wrote:
 Polls app is empty.
 
 The problem is in django_sb_admin
 
 How i can find the root cause of problem and fix that?
 
> On Wed, Jul 4, 2018, 18:26 Jason  wrote:
> You told it to make migration for the app django_sb_admin, but that 
> apparently doesn't include polls.
> 
> try making another migration without the app name qualifier and running 
> it.  
> 
>> On Wednesday, July 4, 2018 at 9:20:49 AM UTC-4, ali reza wrote:
>> Greetings!
>> 
>> Note:
>> mysite is the name of project.
>> django_sb_admin and polls are my apps.
>> python version: 3.6.6
>> 
>> I used inspectdb for creating models.py for django_sb_admin application.
>> pyhton3 manage.py inspectdb > models.py
>> # Here inspectdb worked fine.
>> then is moved models.py into django_sb_admin app.
>> 
>> 
>> 
>> root@kali:~/PycharmProjects/django/azim_projs# ls
>> db.sqlite3  django_sb_admin  manage.py   mysite  polls
>> 
>> =
>> root@kali:~/PycharmProjects/django/azim_projs# cat 
>> django_sb_admin/apps.py 
>> from django.apps import AppConfig
>> 
>> class DjangoSbAdminConfig(AppConfig):
>> name = 'django_sb_admin'
>> 
>> =
>> root@kali:~/PycharmProjects/django/azim_projs# cat mysite/settings.py 
>> <...skipped.>
>> <...skipped.>
>> <...skipped.>
>> 
>> INSTALLED_APPS = [
>> 'django_sb_admin.apps.DjangoSbAdminConfig',
>> 'polls',
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> ]
>> 
>> <...skipped.>
>> <...skipped.>
>> <...skipped.>
>> 
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.mysql',
>> 'OPTIONS': {
>> 'read_default_file': 
>> '/root/PycharmProjects/django/azim_projs/mysite/mySQL.conf',
>> },
>>   }
>> }
>> 
>> =
>> root@kali:~/PycharmProjects/django/azim_projs# cat mysite/mySQL.conf 
>> [client]
>> database = djangoDB
>> host = 127.0.0.1
>> user = root
>> password = "456789"
>> 
>> =
>> =
>> =
>> =
>> root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py 
>> makemigrations django_sb_admin
>> No changes detected in app 'django_sb_admin'
>> 
>> 

Re: from django.contrib.auth.views import login

2018-07-07 Thread Phako Perez
hi,

instead of

from django.contrib.auth.views import login


you need to use

from django.contrib.auth import login

regards.

On Sat, Jul 7, 2018 at 6:41 AM, Ahmad  wrote:

> hello everyone,
>
> when i import this line it's not working.
> from django.contrib.auth.views import login
>
> My Django Versions is 2.0
>
>
>
> from django.conf.urls import url
> from . import views
> from django.contrib.auth.views import login
>
> urlpatterns = [
> url(r'^$',views.home),
> url(r'^login/$', login, {'template_name': 'accounts/login.html'}),
>
> ]
>
>
> error :
>
>
>  from django.contrib.auth.views import login
> ImportError: cannot import name 'login'
>
> --
> 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/a97b6e1a-0990-4ab7-9833-37a0d10b8df6%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/CAF%3Duzp3WLbxyNUORJKNs9L5MTG%2B7xDOoCO40CqCpsMGDUN554Q%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: problems with order by month

2018-08-22 Thread Phako Perez
I think you miss the column to order

cardio = Alumno.objects.filter ( fechanacimiento __month = 
now.month).order_by(‘fechanacimiento’)  
Should be

cardio = Alumno.objects.filter ( fechanacimiento __month = 
now.month).order_by(‘fechanacimiento_day’)

Sent from my iPhone

> On Aug 21, 2018, at 6:38 PM, Osvaldo Ruso Olea  wrote:
> 
> cardio = Alumno.objects.filter ( fechanacimiento __month = 
> now.month).order_by(‘fechanacimiento’)  

-- 
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/66567EB6-0843-47ED-BB24-5F7753BE169F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Excel formula values

2018-08-24 Thread Phako Perez
Hi everyone,

I’m trying to get data from an excel file.
Every thing goes fine till cell contains an excel formula, such cases is 
getting null values 


Here I open the book
———-
report_book = openpyxl.load_workbook(filename, data_only=True)
sheet_list = report_book.sheetnames
worksheet = report_book[sheet_list[0]]

Here I get value for each column
———-
row_num = 3
for k in COL_H[row_num]['CL']:
bb = BASE + k
value = worksheet.cell(row=row_num, column=bb).value


Thanks in advance
Happy weekend!!!

-- 
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/E2D6C45B-9C53-41A7-9959-AF7AA101EE2C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Excel formula values

2018-08-24 Thread Phako Perez
Actually what I need is to print the values from an excel on a table, but 
everything looks good, table formatted in html using CSS style for coloring 

However when a cel in excel is a formula, the value is not showing, as well 
when cel value is 0

Sent from my iPhone

> On Aug 24, 2018, at 8:39 PM, Jason  wrote:
> 
> this is a openpyxl issue, not a django issue.  so you're really posting in 
> the wrong place.
> 
> second, googling 'openpyxl excel formula evaluate' returns a number of 
> responses that could be helpful.
> -- 
> 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/2db0311d-3232-4784-8b18-3974dff41378%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/5BE9620A-3258-4560-806F-8881D685C61C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating seperate unique ids within the same table

2018-10-17 Thread Phako Perez
I suggest to use another table for visit so you can add which doctor, schedule 
time, and comments or so as a patient may have 1 visit or n...

Sent from my iPhone

> On Oct 17, 2018, at 9:59 PM, Joel Mathew  wrote:
> 
> A hospital id needs to be assigned to a patient and printed on their id card. 
> When they present their card or this number, their records can be retrieved 
> at any time. A checkin id is additionally generated each day based on the 
> date and time. A patient can have only one patient id but many checkin ids.
> 
> What can be a good approach to solve this? Should I perhaps create another 
> table just to store the last patient id issued to each clinic?
> 
> 
> 
> 
>> On Wed, 17 Oct 2018 at 21:49, Matthew Pava  wrote:
>> A number is a number, and we don’t need to attach meaning to it.
>> 
>> Why do you need to have continuous ids unique to each clinic?  As a 
>> developer, I would object to anyone forcing such a requirement.  If they 
>> insisted, then I would add a property that is calculated each time based on 
>> the count of patients in the clinic.
>> 
>>  
>> 
>> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] 
>> On Behalf Of Joel Mathew
>> Sent: Wednesday, October 17, 2018 11:01 AM
>> To: django-users@googlegroups.com
>> Subject: Creating seperate unique ids within the same table
>> 
>>  
>> 
>> I have an application which is a clinic management software which allows 
>> login into different clinics, and needs to keep patient records of each 
>> clinic seperately. The patient records are filed in one common model, with a 
>> ForeignKey referring to the clinic to which a patient belongs.
>> 
>>  
>> 
>> Hitherto I had used the AutoField primary key of the customer model as a 
>> hospital identification number for the patient. This number is unique and 
>> used throughout the application to retrieve querysets related to the 
>> customer. My problem is this. I want each patient to have a unique 
>> automatically incrementing id which can be given to them. Obviously since 
>> all patient records (irrespective of which clinic the patient belongs to) 
>> are stored in one model, the ids are not seperated by clinic. cstid 1 may be 
>> of clinic 1, cstid 5 may again be of clinic 1, but cstid 6 may be of clinic 
>> 2. 
>> 
>>  
>> 
>> I need patients  of one clinic to have continuous ids unique to each clinic. 
>> What can I do to achieve this, within my defined models?
>> 
>>  
>> 
>> class Clinic(models.Model):
>> 
>> clinicid = models.AutoField(primary_key=True, unique=True)
>> 
>> name = models.CharField(max_length=60, unique=True)
>> 
>> label = models.SlugField(max_length=25, unique=True)
>> 
>> email = models.EmailField(max_length=50, default='')
>> 
>> mobile = models.CharField(max_length=15, default='')
>> 
>> alternate = models.CharField(max_length=15, default='', blank=True)
>> 
>> about = models.CharField(max_length=250, blank=True)
>> 
>> state = models.CharField(max_length=25)
>> 
>> city = models.CharField(max_length=35)
>> 
>> locality = models.CharField(max_length=35)
>> 
>> pincode = models.IntegerField(default=0)
>> 
>> address = models.TextField(max_length=80, default='', blank=True)
>> 
>> website = models.URLField(blank=True)
>> 
>> logo = models.ForeignKey(ProfilePic, blank=True, null=True, 
>> on_delete=models.CASCADE)
>> 
>> latitude = models.FloatField(blank=True)
>> 
>> longitude = models.FloatField(blank=True)
>> 
>> placeurl = models.URLField(blank=True)
>> 
>> class Meta:
>> 
>> unique_together = ["name", "mobile", "email"]
>> 
>> def __str__(self):
>> 
>> return self.name
>> 
>> 
>> 
>> class customer(models.Model):
>> 
>> # Need autoincrement, unique and primary
>> 
>> cstid = models.AutoField(primary_key=True, unique=True)
>> 
>> name = models.CharField(max_length=35)
>> 
>> age=models.IntegerField()
>> 
>> gender_choices = (
>> 
>> ('male', 'Male'),
>> 
>> ('female', 'Female'),
>> 
>> ('other', 'Something else'),
>> 
>> ('decline', 'Decline to answer'))
>> 
>> gender = models.CharField(
>> 
>> choices=gender_choices, max_length=10, default='male')
>> 
>> maritalstatus_choices = (
>> 
>> ('unmarried', 'Unmarried'),
>> 
>> ('married', 'Married'))
>> 
>> maritalstatus = models.CharField(
>> 
>> choices=maritalstatus_choices, max_length=10, 
>> default='Unmarried')
>> 
>> mobile = models.CharField(max_length=15, default='')
>> 
>> alternate = models.CharField(max_length=15, default='', blank=True)
>> 
>> email = models.CharField(max_length=50, default='', blank=True)
>> 
>> address = models.CharField(max_length=80, default='', blank=True)
>> 
>> 

API Django

2018-10-21 Thread Phako Perez
Hi all,

i'm really new on Django, trying to create an RESTful API, and getting this
error:

curl -i -U Elly:Elly -H "Content-Type: application/json" -X GET
http://192.168.100.22:8000/schedule/3/


HTTP/1.1 403 Forbidden

Date: Mon, 22 Oct 2018 05:44:40 GMT

Server: WSGIServer/0.2 CPython/3.6.3

Content-Type: application/json

Vary: Accept, Cookie

Allow: OPTIONS

X-Frame-Options: SAMEORIGIN

Content-Length: 58


{"detail":"Authentication credentials were not provided."}

on my settings.py added below

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.permissions.IsAuthenticated'
),
}


views.py

from schedule.models import Schedule
from users.models import User
from rest_framework import exceptions
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.authentication import SessionAuthentication,
BasicAuthentication
from rest_framework.permissions import IsAuthenticated

from schedule.serializers import ScheduleSerializer


class ScheduleList(APIView):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)

def authenticate(self, request):
username = request.META.get('X_USERNAME')
if not username:
return None
try:
user = User.objects.get(username=username)
except:
raise exceptions.AuthenticationFailed('No such user')
return Response(user, None)

queryset = 
Schedule.objects.all().filter(user=User.objects.all().filter(id=5)[0])
serializer_class = ScheduleSerializer

def perform_create(self, serializer):
serializer.save(user=self.request.user)


class ScheduleDetail(APIView):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)

def authenticate(self, request):
username = request.META.get('X_USERNAME')
if not username:
return None
try:
user = User.objects.get(username=username)
except:
raise exceptions.AuthenticationFailed('No such user')
return Response(user, None)

serializer_class = ScheduleSerializer

def get_queryset(self):
return 
Schedule.objects.all().filter(user=User.objects.all().filter(id=5)[0])


thanks in advance

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


Re: API Django

2018-10-21 Thread Phako Perez
Thanks Vinod for your quick response, I did, in addition I used -U
(capital) instead (-u), however I got error like

Method GET not allowed.

Method Not Allowed: /schedule/3/
[22/Oct/2018 06:13:50] "GET /schedule/3/ HTTP/1.1" 405 40

On Mon, Oct 22, 2018 at 1:02 AM 'Vinod Kumar' via Django users <
django-users@googlegroups.com> wrote:

> Remove Isauthenticated from rest_framework in settings.py
>
> On Mon, Oct 22, 2018, 11:22 AM Phako Perez <13.phak...@gmail.com> wrote:
>
>> Hi all,
>>
>> i'm really new on Django, trying to create an RESTful API, and getting
>> this error:
>>
>> curl -i -U Elly:Elly -H "Content-Type: application/json" -X GET
>> http://192.168.100.22:8000/schedule/3/
>>
>>
>> HTTP/1.1 403 Forbidden
>>
>> Date: Mon, 22 Oct 2018 05:44:40 GMT
>>
>> Server: WSGIServer/0.2 CPython/3.6.3
>>
>> Content-Type: application/json
>>
>> Vary: Accept, Cookie
>>
>> Allow: OPTIONS
>>
>> X-Frame-Options: SAMEORIGIN
>>
>> Content-Length: 58
>>
>>
>> {"detail":"Authentication credentials were not provided."}
>>
>> on my settings.py added below
>>
>> REST_FRAMEWORK = {
>> 'DEFAULT_AUTHENTICATION_CLASSES': (
>> 'rest_framework.authentication.BasicAuthentication',
>> 'rest_framework.authentication.SessionAuthentication',
>> 'rest_framework.permissions.IsAuthenticated'
>> ),
>> }
>>
>>
>> views.py
>>
>> from schedule.models import Schedule
>> from users.models import User
>> from rest_framework import exceptions
>> from rest_framework.views import APIView
>> from rest_framework.response import Response
>> from rest_framework.authentication import SessionAuthentication, 
>> BasicAuthentication
>> from rest_framework.permissions import IsAuthenticated
>>
>> from schedule.serializers import ScheduleSerializer
>>
>>
>> class ScheduleList(APIView):
>> authentication_classes = (SessionAuthentication, BasicAuthentication)
>> permission_classes = (IsAuthenticated,)
>>
>> def authenticate(self, request):
>> username = request.META.get('X_USERNAME')
>> if not username:
>> return None
>> try:
>> user = User.objects.get(username=username)
>> except:
>> raise exceptions.AuthenticationFailed('No such user')
>> return Response(user, None)
>>
>> queryset = 
>> Schedule.objects.all().filter(user=User.objects.all().filter(id=5)[0])
>> serializer_class = ScheduleSerializer
>>
>> def perform_create(self, serializer):
>> serializer.save(user=self.request.user)
>>
>>
>> class ScheduleDetail(APIView):
>> authentication_classes = (SessionAuthentication, BasicAuthentication)
>> permission_classes = (IsAuthenticated,)
>>
>> def authenticate(self, request):
>> username = request.META.get('X_USERNAME')
>> if not username:
>> return None
>> try:
>> user = User.objects.get(username=username)
>> except:
>> raise exceptions.AuthenticationFailed('No such user')
>> return Response(user, None)
>>
>> serializer_class = ScheduleSerializer
>>
>> def get_queryset(self):
>> return 
>> Schedule.objects.all().filter(user=User.objects.all().filter(id=5)[0])
>>
>>
>> thanks in advance
>>
>>
>> --
>> 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/CAF%3Duzp30Enf%2BE7mWHXG6t2ZAj5YKc11oQkg4HSQOPaHTOO0QsA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAF%3Duzp30Enf%2BE7mWHXG6t2ZAj5YKc11oQkg4HSQOPaHTOO0QsA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> 
>
> *This e-mail and all attachments ar

Re: Oracle database

2018-11-03 Thread Phako Perez
You need to define your db connection details , server schema user password 
within file settings.py inside your project directory

:)

Sent from my iPhone

> On Nov 3, 2018, at 1:26 PM, fatoubinetou...@gmail.com wrote:
> 
> Hi!!! Do you know how to use oracle database with django?
> -- 
> 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/7763b090-38db-41f3-8017-7ef1f9b81b3d%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/BA0927AF-0E13-4FD6-A680-C474CCE6202F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot get Django test migrations to detect test models.py

2018-11-03 Thread Phako Perez
I can suggest to use different name for your test app, as directory test is 
used by Django for actual test your application, maybe is that the reason your 
app is failing 

Sent from my iPhone

> On Nov 3, 2018, at 12:40 PM, ch...@routh.io wrote:
> 
> Hi folks, I'm trying to build a test suite for a django plugin for a field. 
> To test the field I need to have a test model, but since my django app does 
> not provide models, and I have the model in the /tests/models.py it's not 
> detecting the model when the test db migrations are applied. I saw some 
> suggestions on stack overflow to add the test app to the INSTALLED_APPS in 
> the test app, however that causes an 
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. error, 
> which I imagine is caused by the tests app not being a full blown app. What's 
> the proper solution for Django 2.0+ ? I'd prefer not to use the fake models 
> solution as I plan to open source the module and want the field tested 
> against a real db on Django 2.0 and 2.1. 
> 
> Source is here: https://gitlab.routh.io/open-source/django-bleachfields
> 
> Test failures and attempted configurations can be seen in the CI pipeline and 
> commit history.
> 
> Hoping someone can lend their insights.
> -- 
> 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/d525bd73-0db8-4d17-b5b8-254461a9a533%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/C71D5DB6-C733-4265-9B4C-EE05CEC6ED52%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using forms for bulk records

2018-11-03 Thread Phako Perez
You could add your mode into admin.py field so you can modify and all those 
stuff from admin page

Sent from my iPhone

> On Nov 3, 2018, at 7:48 AM, Elias Coutinho  wrote:
> 
> Good morning people.
> 
> As always my problem is conceptual. I have improved a lot, but still in the 
> fight.
> 1 - I have a list of data and I know how to add it to another model at one 
> time. (Easy)
> 2 - It turns out that in this list some data will be filled by the user 
> before saving and will be repeated for each record as a Research and 
> Interviewed Data field.
> 3 - I repeat! It already works with the data entered manually! putting the 
> person instance and the date on the arm.
> 
> QUESTION *
> 
> I have a list of people and wanted to click on one, there it would be 
> redirected to a form (where it is done) where I would already show the person 
> I chose (I have not done yet) and there would be two more fields and 
> Interviewer and logically the interviewer would type in the name of the (in a 
> text field) and the interview date (search_key).
> 
> Then when recording he would have to use this view below:
> 
> https://github.com/ElectronicElectronics/supportalterdata/blob/master/search_core/core/views.py#L66-L87
> 
> 
> What better way to open a screen for the user to choose this data before 
> saving?
> 
> I will post this doubt on other lists with the same text. (Do not be 
> surprised)
> -- 
> 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/b60cdfae-6ff9-4a47-9d72-485e6268d842%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/80544D54-D350-4B90-B9FE-FC1B53B92650%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up admin in visual studio

2018-11-06 Thread Phako Perez
I can recommend py charm 

Sent from my iPhone

> On Nov 6, 2018, at 3:32 PM, Matthew Pava  wrote:
> 
> PyCharm
>  
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Saeed Pooladzadeh
> Sent: Tuesday, November 6, 2018 3:31 PM
> To: Django users
> Subject: Re: Setting up admin in visual studio
>  
> There are some tools for visual studio which can make it a python IDE.
> .I want just want to make the admin.py to work.
> What are other IDE's for Django?
> 
> در سه‌شنبه 6 نوامبر 2018، ساعت 6:03:32 (UTC-8)، Jason نوشته:
> visual studio, the .net/C# IDE, is not for python (at least none of the 
> versions I've used)
>  
> So not sure how to help you other than suggest another IDE
> -- 
> 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/bd5ffb6d-18b0-43fc-ac59-b25dca55c097%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/6af5e6672bfe4b97960d2d21ed590d8a%40iss2.ISS.LOCAL.
> 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/34850594-7A4F-4112-B14B-B6663031EFEC%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin Redesign

2018-11-12 Thread Phako Perez
If I remember correctly you can define your own templates under the template 
directory

Regards

Sent from my iPhone

> On Nov 12, 2018, at 4:49 PM, Zakriya Bilal  wrote:
> 
> I am starting a project in which one of the requirements is to have a custom 
> designed Admin panel. 
> 
> So my question is: Is it possible to redesign the Django Admin panel? 
> Majority of the requirements are related to Front-end design? Is it a good 
> idea to redesign the front-end or just create a new admin area from scratch?
> 
> I ask because the design of the admin panel is important. 
> 
> Just to put it out there, I am coming from Laravel World. 
> -- 
> 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/5544f0cd-5be7-4c91-a2ae-83c4b77dcfa7%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/CD14A672-D2B0-477A-8CBE-85E2D6A1417F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Recommend Tutorials

2018-11-26 Thread Phako Perez
What I can recommend to you for this, is to use same versions for each module 
on the tutorial so your code will works

You can create a virtual environment for each tutorial using viertualenv and as 
a good practice you can list all module requirements on requirements.txt file

Regards

Sent from my iPhone

> On Nov 26, 2018, at 7:33 PM, Tim Johnson  wrote:
> 
> Using django 2.0 on ubuntu with python 3.5.2
> 
> Some tutorials that I have tried have deprecated code and I get
> errors. 
> 
> I would appreciate recommendations for tutorials that are concurrent
> with my version of django.
> 
> I presume that one at
> https://docs.djangoproject.com/en/2.1/intro/tutorial01/ is about as
> current as they come :).
> 
> It would be fun to experiment with others however.
> thanks
> -- 
> Tim Johnson
> http://www.tj49.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/20181127013328.GA2345%40mail.akwebsoft.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/97DDF3D3-7320-4FB8-A81E-7A32F9273351%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python Django Training

2020-02-03 Thread Phako Perez
I would like to be included in this training 

WhatsApp +523323120735
Email: joshue...@gmail.com

Sent from my iPhone

> On 2 Feb 2020, at 10:35, V S V Narsimha Murthy  wrote:
> 
> 
> Hi
> 
> I am interested to attend the python and Django online training. Please add 
> me as well for the training classes. 
> 
> Thanks in advance.
> 
> 
>> On Saturday, February 1, 2020 at 7:12:52 PM UTC+5:30, Srikanth K wrote:
>> Hi,
>> 
>> I am from Hyderabad. I am Python Developer by Profession. I am eager take up 
>> any Python , Django Training (online Preferrable or Weekends). Members who 
>> require can contact me or share me  there idea.
>> 
>> Regards,
>> Srikanth.K
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6de934a0-f065-480b-8bc7-ec1204a02ab8%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9578F326-131A-40F8-98B9-3CBA5DE371F5%40gmail.com.