Re: Looking for a Job

2023-07-16 Thread Ammar Mohammed
Hello
I have 3 years of experience please contact me @o_ammar_o

Regards

On Sun, 16 Jul 2023, 16:43 许三高,  wrote:

> Hi
> I am looking for python developer,I offer 1000-1500 per month.pls give me
> telegram username if you are  interested
>
> mahr...@gmail.com 于2023年7月15日 周六06:31写道:
>
>> Dear Google Group,
>>
>> I am writing to you today to ask for your help in finding a job as a
>> Python and Django developer. I have been working with Python and Django for
>> the past 15 years, and I have developed a strong understanding of the
>> frameworks and the language. I am also proficient in other programming
>> languages, such as Java and JavaScript.
>>
>> I am a highly motivated and self-directed individual, and I am always
>> eager to learn new things. I am also a team player, and I am able to work
>> effectively with others.
>>
>> I have attached my resume to this email, which includes a list of my
>> skills and experience.
>>
>> I am eager to find a position full or part-time where I can use my skills
>> and experience to make a positive impact. I am confident that I would be a
>> valuable asset to your team.
>>
>> Thank you for your time and consideration.
>>
>> Sincerely, Mohamed Mahrous
>>
>> Phone: +201004716399
>>
>> LinkedIn: https://www.linkedin.com/in/mohamed-mahrous-a557b512/
>>
>> --
>> 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/e652ee94-e3ed-4971-8136-9f1cd28de351n%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/CACTuhD%2B09Fe%2BJ5DqXGrbtwDUbkXk%2BxDtOX9POpx8jCrtMZLwQg%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/CAHs1H7uKUbfUtF8KBL%3D7%3DbYgrfA8YWDHEnk__j-u1bjk-_sgFw%40mail.gmail.com.


Re: Difficulty Rendering a Form

2023-05-16 Thread Ammar Mohammed
Hi Mr Starr
The documentation is very clear and helpful.
Check the forms section
https://docs.djangoproject.com/en/4.2/ref/forms/api/#outputting-forms-as-html

Note that you should put your form variable in a double curly Like this
:


{{ signup_form }}
<\form>

Regards
Ammar Mohammed
Whatsapp:
wa.me/249113075979



On Tue, May 16, 2023, 20:55 Michael Starr 
wrote:

> I am having difficulty rendering a form. Does anyone have a CONCISE
> tutorial for me?
>
> Michael
>
> --
> 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/045cd9f2-20c2-4ecd-b5fe-409604d249fdn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/045cd9f2-20c2-4ecd-b5fe-409604d249fdn%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7vUmt-p3CX3Qo4jVhi_Kcsee_97%3DeDb1pd-03TArTW8og%40mail.gmail.com.


Re: Spies in California and America

2023-03-28 Thread Ammar Mohammed
Sorry but this is off topic!

On Wed, Mar 29, 2023, 01:15 Michael Starr  wrote:

> So does  anyone have an update on the police state and spying of Democrat
> Ukrainians in America yet?
>
> Michael
>
> --
> 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/3711c50c-4f8d-4bef-97d5-9b37d33049a0n%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/CAHs1H7s8ArjDXV4fP8%3D3%3DZHF6FgAkfRdc4nz3m107HJaEDqTRw%40mail.gmail.com.


Re: merge fields from different table

2022-11-04 Thread Ammar Mohammed
*Get your Locations object :*
obj = Locations.objects.get(pk=1)
*Then get the region:*

obj.region.region_name

On Fri, 4 Nov 2022, 7:29 PM Kala Rani,  wrote:

> models.py
> class Regions(models.Model):
>  region_name = models.CharField(max_length=255)
>
>   class Locations(models.Model): region = models.ForeignKey(Regions,
> on_delete=models.CASCADE,blank=True,null=True) name =
> models.CharField(max_length=255)
>
>
> How to do this query in django?
> select locations.name,regions.region_name from locations inner join
> regions on locations.region_id = regions.id order by locations.name;
>
> I want to show in select tag like country-city
>
> --
> 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/29b954e2-646d-4b58-ba0d-381660ba2f33n%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/CAHs1H7t8M2L_P-xwUBD3B_3VWT_JwOgYRsFiXnTLcBq%2BsdfDhw%40mail.gmail.com.


Re: Template inheritance not working

2022-10-31 Thread Ammar Mohammed
Hello dear
There is a little mistake in your code :
You should put the {%block block_name %} in your base template with no code
and the put the code you want to be displayed in your child template file
Here is an example :

// file.html :

{% extends "index.html" %}

{% block content %}
Hello, this is a test.
Help me.
{% endblock %}

//index.html:





Document


{% block content %}

{% endblock %}




-- 
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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com

.


On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com> wrote:

> I have been trying to get my templates to work but they have been
> ineffective. here is my code:
> {% extends "index.html" %}
>
> 
> 
> 
> 
> 
> Document
> 
> 
> 
> {% block content %}
>
>
> {% endblock %}
> 
> 
> 
>
> //index.html:
>
> 
> 
> 
> 
> 
> Document
> 
> 
> {% block content %}
> Hello, this is a test.
> Help me.
> {% endblock %}
> 
> 
>
> --
> 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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%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/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com.


Re: page html

2022-10-31 Thread Ammar Mohammed
Hello

Have you added your index page view to your project's urlpatterns ?

Regards

On Mon, 31 Oct 2022, 11:33 AM REMY TOUITOU,  wrote:

> Hello , thanks you , I try to connect , what is you Telefon number , mine
> is 0033687798426
>
> Le dimanche 30 octobre 2022, Adebileje Nurudeen  a
> écrit :
>
>> Can we chat on WhatsApp for more help on that??
>>
>> On Sun, Oct 30, 2022 at 8:46 PM REMY TOUITOU 
>> wrote:
>>
>>> hELLO , when i launch , in visual studio code ,i can't found the page
>>> index.html,
>>>
>>> i launch http//localhost:8000 AND I SEE the first page created with
>>> Django
>>>
>>> and i want to see the page index.HTML ;
>>>
>>> Thanks you for your help
>>>
>>> --
>>> 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/64e889fc-de5e-4696-9366-54ec049b91ben%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/CAOfwBVgsV1RihLOydb%2BUdEzBeBqBrhHZn04sudWWXqeKB-KMQw%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/CAD9WEx0-hwAtMOczTc6AZTz4WoCKuiYJz6AVeSnGt-qkbG%2BZ8Q%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/CAHs1H7sCpZUuEoDa60gR3_3giUw88Dm-Va9zkZOj3e1v5SzNsw%40mail.gmail.com.


Re: PLEASE HELP ME KNOW HOW TO ARRANGE INSTALLED APPS.

2022-10-29 Thread Ammar Mohammed
Hello Dear
You should name your apps without the app word in the end
Example :
INSTALLED_APPS = [
"apps.store'',
" apps.core",
]
This will definitely work

Regards

On Wed, 19 Oct 2022, 7:30 AM regan opere,  wrote:

> Many, thanks for the reply. However, I have two apps in the directory
> called Apps..
> so when I name the apps in the settings using
> tiles.apps.TilesConfig' it still does'nt work
>
>   naming them like this:
>
>  'apps.core.apps',
>
> 'apps.store.apps',
> also still giver the error: django.core.exceptions.ImproperlyConfigured:
> Application labels aren't unique, duplicates: apps
>
> however, when I delete one of the apps from the settings, the server runs
> without an error
> On Wednesday, October 19, 2022 at 2:17:55 AM UTC+3 Codex wrote:
>
>> Lets take App Directory name tiles.
>> So inthe installed app list it will be
>>
>> 'tiles.apps.TilesConfig',
>> Or put simply
>> 'tiles',
>> Hope it helps .
>>
>>
>> On Tue, Oct 18, 2022, 06:16 regan opere  wrote:
>>
>>> Hello, I am new to django and I am still learning.
>>> I have created two apps core and store and I have registered them in the
>>> settings file of my root directory.
>>>  This is the error I get:
>>> django.core.exceptions.ImproperlyConfigured: Application labels aren't
>>> unique, duplicates: apps
>>>
>>> my settings look like this
>>> INSTALLED_APPS = [
>>> 'django.contrib.admin',
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.messages',
>>> 'django.contrib.staticfiles',
>>>
>>> 'apps.core.apps',
>>>
>>> 'apps.store.apps',
>>>
>>>
>>> and their individual apps.py look like this:
>>>
>>> class CoreConfig(AppConfig):
>>> default_auto_field = 'django.db.models.BigAutoField'
>>> name = 'core'
>>>
>>>
>>> and
>>>
>>> class StoreConfig(AppConfig):
>>> default_auto_field = 'django.db.models.BigAutoField'
>>> name = 'store'
>>>
>>>
>>>
>>> without the second app 'store" the server runs just fine
>>>
>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/fab8949f-1012-4fad-8259-b63c67195f69n%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/65db3780-57ec-41ec-afaf-abe16ae85e69n%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/CAHs1H7uxkrLFMvDs2t9w7hRJeyhNg21QxDKHj6-Dqhnv99cSNg%40mail.gmail.com.


Re: Need to pick up easy task in repo

2022-10-14 Thread Ammar Mohammed
Dear Rahul
First this is not a repository. It's a help group .
You should have email notifications to get new questions and help users
solve the problem. If you don't know the answer to a problem you can follow
with the thread to get the right answer.

Regards
Ammar Mohammed

On Fri, 14 Oct 2022, 7:46 PM anshika singh,  wrote:

>
>
> Hi Team,
>
> I want to start contributing in this repository .Please let me know how to
> start .
> Email id: anshika@gmail.com
> Please let me know easy tasks which i can pick up in beginning.
>
> Regards,
> Anshika
>
> --
> 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/91743540-8ee5-40d8-a206-7b5bc0981468n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/91743540-8ee5-40d8-a206-7b5bc0981468n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7tvrh87bNmKsy4t8Xd82%2BD7YehFSTtqLuPbtyqgQWV6qg%40mail.gmail.com.


Re: Checking API Results before saving

2022-09-02 Thread Ammar Mohammed
Hello ,

You can design a serializer for each api endpoint and use it in your view
to validate your data like validating forms data :
Pseducode :
res = requests.post(url+some_endpoint, data)
endpoint_serializer.validate(res.data)
if serializer.is_valid():
#do your stuff
else :
#do something

Best Regards

Ammar Mohammed

On Fri, 2 Sep 2022, 01:41 lone...@gmail.com,  wrote:

> Hello all,
>
> I am sending an GET request to an external API and I would like to
> validate the response before I save it to my model.  How do I do this?
>
> Thank you.
>
> --
> 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/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7spUzCOMX%2BDs9%3D25ackprZ86GPBBBwS5a_ig9Ca%3DzTMog%40mail.gmail.com.


Re: Negative Stock Prevention

2022-08-31 Thread Ammar Mohammed
I don't think you need that constraint after using the PositiveIntegerField
.


On Thu, 1 Sep 2022, 02:45 Ryan Nowakowski,  wrote:

> I don't see any error. Did you forget to post it?
>
> On August 31, 2022 5:57:32 AM CDT, tech george 
> wrote:
>>
>> Hello,
>>
>> Sorry for the late reply.
>>
>> I changed the models as below and added checkConstraint , But when I
>> migrate I get the below error.
>>
>> What am I still doing wrong?
>>
>> class Stock(models.Model):
>> quantity = models.PositiveIntegerField(default='0', blank=True,
>> null=True)
>> reorder_level = models.PositiveIntegerField(default='0', blank=True,
>> null=True)
>>
>> class Meta:
>> CheckConstraint(check=Q(quantity__gt=0), name='quantity')
>>
>>
>>
>> On Tue, Aug 30, 2022 at 6:09 PM Thomas Couch  wrote:
>>
>>> I don't see where you define the quantity variable, should that be
>>> instance.quantity? Also, presumably you want to check if quantity is
>>> greater than or equal to qu rather than 0.
>>> Try changing `if quantity > 0` to `if instance.quantity >= qu`
>>>
>>>
>>> On Tuesday, August 30, 2022 at 3:44:51 PM UTC+1 Ryan Nowakowski wrote:
>>>
 On Mon, Aug 29, 2022 at 05:18:39PM +0300, tech george wrote:
 > Please help crack the below code, I want to prevent negative stock,
 and if
 > the stock is == 0, deduct it from reorder_level instead.
 > Currently, the stock goes negative.
 >
 > models.py
 >
 > class Stock(models.Model):
 > quantity = models.IntegerField(default='0', blank=True, null=True)
 > reorder_level = models.IntegerField(default='0', blank=True,
 null=True)
 >
 > class Dispense(models.Model):
 > drug_id = models.ForeignKey(Stock,
 > on_delete=models.SET_NULL,null=True,blank=False)
 > dispense_quantity = models.PositiveIntegerField(default='1',
 > blank=False, null=True)
 > taken=models.CharField(max_length=300,null=True, blank=True)

 Maybe change quantity and reorder_level to PositiveIntegerField?

>>> --
>>> 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/9ef2d260-7c1a-4ff1-95ca-c13ded5f9f7bn%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/DDF83E16-47C4-4E38-90DE-6CDAE28268DB%40fattuba.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/CAHs1H7uN4xCF%2B7AKqxSufatWiUN_n9cw4uBALo-ENFOfirp_hg%40mail.gmail.com.


Re: I want to fetch the value of radio field for updation but it only doesn't fetch even i use condition and value does comes but doesn't checked

2022-08-23 Thread Ammar Mohammed
Email





{% with val_gen=datas.gender%}


{{val_gen}}


gender:

Male 


Female 





{% endwith %}





On 22 Aug 2022 08:57, "Abhinandan K"  wrote:

> Email
> 
> {% with val_gen=datas.gender%}
> {{val_gen}}
> gender:
>
>  checked{% endif %} >Male
>  checked{% endif %}>Female
> 
> {% endwith %}
> 
>
> --
> 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/CAA6_Mp44RQjMeWfVW82vvT2-GLrv5Jpu2nb_6edWON_3sgXQwQ%
> 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/CAHs1H7t75MThqaGW7GZkbbPWOv0-%2BMUgq1VWFBGRgRAmiVYoww%40mail.gmail.com.


Re: Customize serializer errors with incorrect data

2022-08-04 Thread Ammar Mohammed
Hello Sencer
You can add cuatom functions to your serializer to return the data with the
zerializer .

For example you can add :
def email_serializer(email):
   if !email.endswith("gmail.com"):
 raise SerializerError("Error wrong email address : ", email)

This is just an example your functions can look in and way.

In the email field in your serializer you ahould add the "email_serializer"
function to the serializers.

Regards
--

Ammar Mohammed
On 3 Aug 2022 07:00, "Sencer Hamarat"  wrote:

> Hi,
>
> I found a way to customize error messages of the serializer by adding
> extra_kwargs into the serializer meta class.
>
> But, I'm wishing to render custom serializer errors with the incorrect
> data. For example:
>
> class CreateUserSerializer(serializer.ModelSerializer):
> class Meta:
> model = User
> fields = ('first_name', 'last_name', 'is_active', 'email')
>
> def create_users(request):
> ...
> serialized_data = CreateUserSerializer(data=data, many=True)
> if serialized_data.is_valid():
> serialized_data.save()
>
> Say, afew of the user data has no email information.
> This will return error like:
>
> {"email":["This field may not be blank."], "email":["This field may not be
> blank."], ...}
>
> I want to add error related data or at least index number to error text
>
> Is there a way to do that?
>
> Kind regards,
> Sencer HAMARAT
>
> --
> 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/CACp8TZjwjk6yFAq%2B%3Dw9W6sKeX%3Dg%2Bx8k%
> 3DHJf3bpMpJaOSMqyTAg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACp8TZjwjk6yFAq%2B%3Dw9W6sKeX%3Dg%2Bx8k%3DHJf3bpMpJaOSMqyTAg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7s5HMvUP6_xBFequmKM2kgnSzebcNj%2BPMSfDHfAEO7ykg%40mail.gmail.com.


Re: ForeignKey Reverse Relation Fail

2022-07-31 Thread Ammar Mohammed
Using many to many relationship will work better.
Nice note 珞
Your quote Translation :
"لا يؤمن احدكم حتي يحب لاخيه ما يحب لنفسه"
On 27 Jul 2022 19:04, "Malik Rumi"  wrote:

> Thanks, but the recursive foreignkey *is* a one to many relationship...
> unless you're talking about something else?
> *“None of you has faith until he loves for his brother or his neighbor
> what he loves for himself.”*
>
>
> On Wed, Jul 27, 2022 at 10:16 AM Ammar Mohammed 
> wrote:
>
>> Hi
>> Have you tried using OneToMany relationship ?
>> On 27 Jul 2022 12:18, "Malik Rumi"  wrote:
>>
>>> I have a model with a recursive foreign key to 'self'. This is intended
>>> to model a parent child
>>> relation among instances. The forward relation, on a field called
>>> 'childof', works as expected.
>>> The reverse relation, using the related_name 'parent', comes up as a
>>> RelatedManager,
>>> again as expected. However, parent.count(), parent.all(), etc., always
>>> give me the "Manager is
>>> not accessible on instances" error. Many of these parent instances will
>>> themselves also be a
>>> childof some other instance, and apparently, that's my problem. I don't
>>> know how to make Django
>>> recognize the dual nature of some instances. Is there a way to hack the
>>> RelatedManager to fix this?
>>>
>>> I am not getting any accessor errors from manage.py check.
>>>
>>> I posted this to Django Forum, but the respondent was not able to
>>> duplicate my issue - i.e.,
>>> he said it worked as expected for him. :-(
>>>
>>> I saw a suggestion to use an explicit junction table on Stack Overflow,
>>> but making a round trip - or two - to an external table seems like an
>>> awful lot of overhead for this situation.
>>>
>>> If instead of a junction table, if I made an explicit parentto field on
>>> the model, would that work?
>>> Presumably the related name on the childof field would still fail like
>>> it does now,
>>> but I would instead have the explicit parent field to work with. I still
>>> would not have the
>>> automatic reverse relation, and I would have to come up with a script to
>>> fill in the parentto
>>> field, but that might solve my problem:
>>> # pseudocode
>>> family = c.itertools.groupby(instance.childof)
>>> family = c.pandas.groupby(instance.childof)
>>> for f in family:
>>> pop = c.objects.get(instance.childof)
>>> OR
>>> pop = instance.childof
>>> c.objects.update(pop.parentto=f) # where parentto is a Postgresql
>>> ArrayField
>>> OR # https://docs.djangoproject.com/en/4.0/ref/models/
>>> relations/#django.db.models
>>> .fields.related.RelatedManager.add:
>>> >>> b = Blog.objects.get(id=1)
>>> >>> e = Entry.objects.get(id=234)
>>> >>> b.entry_set.add(e) # Associates Entry e with Blog b
>>> SEE ALSO: https://docs.djangoproject.com/en/4.0/topics/db/examples/
>>> many_to_one/
>>>
>>> If I did this two field hack, then I don't really need either one to be
>>> ForeignKeys any more,
>>> do I? They could be a CharField and an ArrayField, couldn't they? That
>>> breaks the extended
>>> lookup chain - but I don't have that now, anyway - or at least, I only
>>> have it in one direction.
>>>
>>> --
>>> 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/3555d391-9c9e-440f-a603-103c9ccdc858n%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/3555d391-9c9e-440f-a603-103c9ccdc858n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/django-users/xGtwxhx2Nrw/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAHs1H7tjom_GRucP8Dx3x8AzQobS4GCva8a0nuN3b
&

Re: How to create current user field in dango rest framework

2022-07-28 Thread Ammar Mohammed
Hi Ashok
Do you wabt to use the current user or creating a new user ?
Is it like signing up a new user ?
On 27 Jul 2022 22:19, "Ashok garsulla"  wrote:

> Please tell me how can I create current User in dango Rest 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/21baa025-b118-4f15-bba3-52f4875c1d33n%
> 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/CAHs1H7siqeasuph7BxhXm43n66cdpPu5ED4pW7oNzue95Wu-cw%40mail.gmail.com.


Re: ForeignKey Reverse Relation Fail

2022-07-27 Thread Ammar Mohammed
Hi
Have you tried using OneToMany relationship ?
On 27 Jul 2022 12:18, "Malik Rumi"  wrote:

> I have a model with a recursive foreign key to 'self'. This is intended to
> model a parent child
> relation among instances. The forward relation, on a field called
> 'childof', works as expected.
> The reverse relation, using the related_name 'parent', comes up as a
> RelatedManager,
> again as expected. However, parent.count(), parent.all(), etc., always
> give me the "Manager is
> not accessible on instances" error. Many of these parent instances will
> themselves also be a
> childof some other instance, and apparently, that's my problem. I don't
> know how to make Django
> recognize the dual nature of some instances. Is there a way to hack the
> RelatedManager to fix this?
>
> I am not getting any accessor errors from manage.py check.
>
> I posted this to Django Forum, but the respondent was not able to
> duplicate my issue - i.e.,
> he said it worked as expected for him. :-(
>
> I saw a suggestion to use an explicit junction table on Stack Overflow,
> but making a round trip - or two - to an external table seems like an
> awful lot of overhead for this situation.
>
> If instead of a junction table, if I made an explicit parentto field on
> the model, would that work?
> Presumably the related name on the childof field would still fail like it
> does now,
> but I would instead have the explicit parent field to work with. I still
> would not have the
> automatic reverse relation, and I would have to come up with a script to
> fill in the parentto
> field, but that might solve my problem:
> # pseudocode
> family = c.itertools.groupby(instance.childof)
> family = c.pandas.groupby(instance.childof)
> for f in family:
> pop = c.objects.get(instance.childof)
> OR
> pop = instance.childof
> c.objects.update(pop.parentto=f) # where parentto is a Postgresql
> ArrayField
> OR # https://docs.djangoproject.com/en/4.0/ref/models/
> relations/#django.db.models
> .fields.related.RelatedManager.add:
> >>> b = Blog.objects.get(id=1)
> >>> e = Entry.objects.get(id=234)
> >>> b.entry_set.add(e) # Associates Entry e with Blog b
> SEE ALSO: https://docs.djangoproject.com/en/4.0/topics/db/examples/
> many_to_one/
>
> If I did this two field hack, then I don't really need either one to be
> ForeignKeys any more,
> do I? They could be a CharField and an ArrayField, couldn't they? That
> breaks the extended
> lookup chain - but I don't have that now, anyway - or at least, I only
> have it in one direction.
>
> --
> 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/3555d391-9c9e-440f-a603-103c9ccdc858n%
> 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/CAHs1H7tjom_GRucP8Dx3x8AzQobS4GCva8a0nuN3bEWVB2Taqw%40mail.gmail.com.


Re: Django tutor.

2022-07-27 Thread Ammar Mohammed
Hi
Yes of course
Available every weekend !

Ammar Mohammed
On 27 Jul 2022 15:49, "pediah wanmi"  wrote:

> I am a djongk intermediary, please can I
>  get a tutor?
>
> --
> 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/CABd3QauHU4wdePFvGsY3V-GSO8Ly37zMqgmcV2tyDV56Sw81Tw%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABd3QauHU4wdePFvGsY3V-GSO8Ly37zMqgmcV2tyDV56Sw81Tw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7t9Uh35%2B8pdsN1JjMLqphkimWaHwoRusWuhx8mndgsZLQ%40mail.gmail.com.


Re: Blog application with django

2022-07-26 Thread Ammar Mohammed
Hi
I can help you with that
Please contact me in whatsapp :
httpa://wa.me/249113075979

Regards
Ammar Mohammed
On 26 Jul 2022 17:33, "MAHESH KUMAR"  wrote:

> Hi all
> https://www.health.harvard.edu/mind-and-mood/relaxation-
> techniques-breath-control-helps-quell-errant-stress-response
>
> I want this type blog application please help me anybody coding part please
>
>
> Thanks & Regards
>
>
> --
> 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/f31400ff-20b6-4e85-be98-30e62f90bac0n%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f31400ff-20b6-4e85-be98-30e62f90bac0n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7vfYUj6bZvNFEE%3D7jgst5KBq7qykanS4RbP66LB9kbYSw%40mail.gmail.com.


Re: How to use Authentication in DRF

2022-07-21 Thread Ammar Mohammed
How is your login view working ?
Or this is your login view ?

Please share the whole app views and urls.

(I suggest using DRF class based views as it's alot useful and helpful when
it comes to authentication and permissions)

Regards,

--
Ammar Mohammed
On 21 Jul 2022 08:24, "Salima Begum"  wrote:

> Thanks  Ammar Mohammed for the quick response, After login to the
> website  through Chrome browser, I got the response.
>  But when I run from Postman to test API by mentioning Basic AUTH
> credentials of which I created user models login credentials it's giving
> home page html response but which I want is JSON Response. Why it's not
> reading credentials I mentioned there?
>
> Thanks
> ~Salima
>
>
> On Thu, Jul 21, 2022 at 10:58 AM Ammar Mohammed 
> wrote:
>
>> Hey Salima
>> I guess you can use access token authentication in DRF.
>> But Do you recive the response without logging in?
>> Please explain more please
>>
>> --
>>
>> Ammar Mohammed
>> +249 113075979
>> On 21 Jul 2022 07:08, "Salima Begum" 
>> wrote:
>>
>>> Hi all,
>>>
>>> I am trying to convert my current project(It is developed in Django) to
>>> DRF. So, I set up DRF into my project then I wrote an endpoint for after
>>> user login on the session I need to get the response when I test the
>>> my-reviews API.
>>>
>>> models.py
>>> ```
>>> class customer(models.Model):
>>> cust_id = models.IntegerField(null="true")
>>> email = models.CharField(max_length=100)
>>> # reemail = models.CharField(max_length=100, null='true')
>>> password = models.CharField(max_length=500)
>>> repassword = models.CharField(max_length=500, null='true')
>>> firstname = models.CharField(max_length=225)
>>> lastname = models.CharField(max_length=225, null=True)
>>> state = models.CharField(max_length=64, null=True)
>>> city = models.CharField(max_length=64, null=True)
>>> location = models.CharField(max_length=225, null=True)
>>> Zip = models.CharField(max_length=64)
>>> mailing = models.CharField(max_length=1000)
>>> added_date = models.DateTimeField(editable=False)
>>> modified_date = models.DateTimeField(null=True, blank=True)
>>> last_loggedin = models.DateField()
>>> ```
>>> views.py
>>>
>>> ```
>>> @api_view(['GET'])
>>> def myservicereviewAPI(request):
>>> # If a user session is logged out it will redirect to the home page.
>>> if ((request.session.get('email') is None) or
>>> (request.session.get('email') == "")):
>>> # redirecting user after logged out to home page.
>>> return HttpResponseRedirect("/home")
>>> if request.method == 'GET':
>>> students = services_review.objects.all().order_by('-added_date')
>>> serializer = ServicesReviewSerializer(students, many=True)
>>> return Response(serializer.data)
>>> ```
>>> urls.py
>>> ```
>>> path('myservicereviewAPI', views.myservicereviewAPI,
>>> name='myservicereviewAPI'),
>>> ```
>>>
>>> Results of Postman when I run 'myservicereviewAPI'
>>>
>>> After login Browser results of 'myservicereviewAPI'
>>>
>>> Please Help me to achieve this.
>>>
>>> Thanks
>>> ~Salima
>>>
>>> --
>>> 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/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq
>>> -9BWtS-faT%3DYAA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq-9BWtS-faT%3DYAA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/CAHs1H7vv1b5zYXTNAk-Pm9FU5r9wVCJjODi9Pmc6BCaykKRnu
>> Q%40mail.gmail.com
>> <https://groups.google.com

Re: How to use Authentication in DRF

2022-07-20 Thread Ammar Mohammed
Hey Salima
I guess you can use access token authentication in DRF.
But Do you recive the response without logging in?
Please explain more please

--

Ammar Mohammed
+249 113075979
On 21 Jul 2022 07:08, "Salima Begum"  wrote:

> Hi all,
>
> I am trying to convert my current project(It is developed in Django) to
> DRF. So, I set up DRF into my project then I wrote an endpoint for after
> user login on the session I need to get the response when I test the
> my-reviews API.
>
> models.py
> ```
> class customer(models.Model):
> cust_id = models.IntegerField(null="true")
> email = models.CharField(max_length=100)
> # reemail = models.CharField(max_length=100, null='true')
> password = models.CharField(max_length=500)
> repassword = models.CharField(max_length=500, null='true')
> firstname = models.CharField(max_length=225)
> lastname = models.CharField(max_length=225, null=True)
> state = models.CharField(max_length=64, null=True)
> city = models.CharField(max_length=64, null=True)
> location = models.CharField(max_length=225, null=True)
> Zip = models.CharField(max_length=64)
> mailing = models.CharField(max_length=1000)
> added_date = models.DateTimeField(editable=False)
> modified_date = models.DateTimeField(null=True, blank=True)
> last_loggedin = models.DateField()
> ```
> views.py
>
> ```
> @api_view(['GET'])
> def myservicereviewAPI(request):
> # If a user session is logged out it will redirect to the home page.
> if ((request.session.get('email') is None) or
> (request.session.get('email') == "")):
> # redirecting user after logged out to home page.
> return HttpResponseRedirect("/home")
> if request.method == 'GET':
> students = services_review.objects.all().order_by('-added_date')
> serializer = ServicesReviewSerializer(students, many=True)
> return Response(serializer.data)
> ```
> urls.py
> ```
> path('myservicereviewAPI', views.myservicereviewAPI,
> name='myservicereviewAPI'),
> ```
>
> Results of Postman when I run 'myservicereviewAPI'
>
> After login Browser results of 'myservicereviewAPI'
>
> Please Help me to achieve this.
>
> Thanks
> ~Salima
>
> --
> 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/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq
> -9BWtS-faT%3DYAA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq-9BWtS-faT%3DYAA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHs1H7vv1b5zYXTNAk-Pm9FU5r9wVCJjODi9Pmc6BCaykKRnuQ%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread Ammar Mohammed
This topic solves your problem .

https://djangocentral.com/managing-media-files-in-django/

Ammar Mohammed
Tel: 0113075979
On 31 Jan 2022, 17:36 +0200, DJANGO DEVELOPER , wrote:
> tell me what you want to get as a result? do you want to display multiple 
> images on HTML template?
>
> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar  wrote:
> > So guide me the write way ...
> >
> > On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER,  
> > wrote:
> > > you are doing it the wrong way. totally the wrong way. I am not being 
> > > rude.
> > >
> > > On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar  
> > > wrote:
> > > > Gide me Django develpers. I just want to display my pictures that are 
> > > > created each time new.
> > > > My mages are created in my project folder, not in the static folder.
> > > > how I display images on the HTML page by using the path of my project 
> > > > folder.
> > > >
> > > > views.py
> > > >
> > > > def Image_display(request):
> > > >   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> > > >   filename = 'Tree.jpg'
> > > >   filepath = BASE_DIR + '//' + filename
> > > >   images = Image.objects.all('filepath')
> > > >   return render(request, "xyz.html", {'images': images})
> > > >
> > > > url.py
> > > > path('Image_display/', views.Image_display, name="Image_display"),
> > > >
> > > > HTML page
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  --
> > > > 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/8da245ea-ea90-4730-83c0-accafc93b86bn%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/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%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/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%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/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%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/c0a72401-90b1-4900-b2b7-b5dee6ea0c9f%40Spark.


RE: copy value from field1 to field2

2022-01-28 Thread Ammar Mohammed
Hi
Where is your forms.py ???

Ammar Mohammed
Tel: 0113075979
On 28 Jan 2022, 23:52 +0200, Feroz Ahmed , wrote:
> Hi, Thanks for your support below are the views and models,   plz guide,   no 
> errors but no success Views.py                       (cmonth is none value 
> and excluded in form)  month is insertable from form templatedef 
> insert(request):               form=StudentForm()               if 
> request.method=="POST":                              
> form=StudentForm(request.POST)                              
> cmonth=request.GET.get('month')                              if 
> form.is_valid():                                             form.save()      
>                                        return redirect('/home1')              
>  return 
> render(request,'enroll/insert.html',{'form':form})--
>  Models.pyclass student(models.Model):  month = 
> models.CharField(max_length=64, choices=COLOR_CHOICES, default='plz')  
> cmonth=models.CharField(max_length=64)  name= models.CharField(max_length=64) 
>  salary= models.CharField(max_length=64)#def student(month = 
> request.GET['value'], cmonth=cmonth)  def fm(request):    fm 
> =student.objects.create(month=request.GET['month'],cmonth=cmonth) 
> -
>   
> --Here
>  I want CMonth data from Month   From: 
> django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Ammar MohammedSent: 29 January 2022 01:32To: 'Rahul Chauhan' via 
> Django usersSubject: Re: copy value from field1 to field2
> Hello
> You can do it in your views.py
> #If request method is get you can use
> val2 = request.GET.get('val1')
> #if method is get you can use
> val2 = request.POST.get('val1')
>
> #then you can use val2 to in sert it in the dB
> Model.objects.create(val1=request.GET['val1'], val2=val2)
>
> Regards
>
> Ammar Mohammed
> Tel: 249113075979
> On 28 Jan 2022, 21:52 +0200, Feroz Ahmed , wrote:
> > Hi,
> > I am new to django,
> > I have field1 as dropdown with mentioned months name
> > filed2 is none and excluded in forms
> >
> > I want while inserting the data , if I select month , it should insert the 
> > same value in field2
> >
> > request your support
> > Ex:
> > field1 .value('JAN')
> >
> > field2 is excluded from froms.py
> > want the value to be inserted in field2  from field 1 in db
> >
> > update / delete /insert functions are fine, no issues  but field2 is not 
> > getting value from field 1 Thank You --
> > 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/61f44948.1c69fb81.9ac1a.ad93%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/51d615fc-43dd-4250-8d04-101c06ad3bf8%40Spark.
>  --
> 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/61f4656c.1c69fb81.f300.d6d5%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/a0b7392e-0477-4533-b026-5171879dbc93%40Spark.


Re: copy value from field1 to field2

2022-01-28 Thread Ammar Mohammed
Hello
You can do it in your views.py
#If request method is get you can use
val2 = request.GET.get('val1')
#if method is get you can use
val2 = request.POST.get('val1')

#then you can use val2 to in sert it in the dB
Model.objects.create(val1=request.GET['val1'], val2=val2)

Regards

Ammar Mohammed
Tel: 249113075979
On 28 Jan 2022, 21:52 +0200, Feroz Ahmed , wrote:
> Hi,
> I am new to django,
> I have field1 as dropdown with mentioned months name
> filed2 is none and excluded in forms
>
> I want while inserting the data , if I select month , it should insert the 
> same value in field2
>
> request your support
> Ex:
> field1 .value('JAN')
>
> field2 is excluded from froms.py
> want the value to be inserted in field2  from field 1 in db
>
> update / delete /insert functions are fine, no issues  but field2 is not 
> getting value from field 1 Thank You --
> 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/61f44948.1c69fb81.9ac1a.ad93%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/51d615fc-43dd-4250-8d04-101c06ad3bf8%40Spark.


Re: Creating some fields on the fly in django template

2021-10-24 Thread Ammar Mohammed
Hello
In your case i wouldn't import all the form at once using, {{ form.as_p}}

Instead try to import every single field of your form thenyou can use
JavaScript to show and hide fields according to input because django can't
do this kind of editing.


On 24 Oct 2021 7:32 PM, "Dina Dodin"  wrote:

Hi

i have forms (not using Models)
in some forms i want to introduce dropdown list for example in case some
specific value is selected for another existing form field.

i tried something if found in google but nothing seems to work for me.

if someone can help me with it will be great!

in html template i get the form as this: {{ form.as_p }}
i want to show/hide a new field according to value i select of existing
field value.

-- 
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/4974223a-7544-4934-8f1f-e07675590d44n%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/CAHs1H7uWigr_Z6kQHb%3DbZE3F-JXrj7JA-y9T5zWVn15fkmvdMw%40mail.gmail.com.


Re: Child data table in Django

2021-10-13 Thread Ammar Mohammed
Hello Dear

You can use djangos prefetch_related in the docs :

prefetch_related()¶

prefetch_related(**lookups*)¶


Returns a QuerySet that will automatically retrieve, in a single batch,
related objects for each of the specified lookups.

This has a similar purpose to select_related, in that both are designed to
stop the deluge of database queries that is caused by accessing related
objects, but the strategy is quite different.

select_related works by creating an SQL join and including the fields of
the related object in the SELECT statement. For this reason,
select_related gets
the related objects in the same database query. However, to avoid the much
larger result set that would result from joining across a ‘many’
relationship, select_related is limited to single-valued relationships -
foreign key and one-to-one.

prefetch_related, on the other hand, does a separate lookup for each
relationship, and does the ‘joining’ in Python. This allows it to prefetch
many-to-many and many-to-one objects, which cannot be done using
select_related, in addition to the foreign key and one-to-one relationships
that are supported by select_related. It also supports prefetching of
GenericRelation

 and GenericForeignKey
,
however, it must be restricted to a homogeneous set of results. For
example, prefetching objects referenced by a GenericForeignKey is only
supported if the query is restricted to one ContentType.

For example, suppose you have these models:

from django.db import models
class Topping(models.Model):
name = models.CharField(max_length=30)
class Pizza(models.Model):
name = models.CharField(max_length=50)
toppings = models.ManyToManyField(Topping)

def __str__(self):  # __unicode__ on Python 2
return "%s (%s)" % (
self.name,
", ".join(topping.name for topping in self.toppings.all()),
)

and run:

>>> Pizza.objects.all()

Url : https://docs.djangoproject.com/en/1.10/ref/models/querysets/


On Wed, 13 Oct 2021, 2:06 PM Eugene TUYIZERE, 
wrote:

> Dear All,
>
> Kindly assist me to have a tutorial or code to make this kind of table in
> django. I failed to do this from the datatable .net tutorial.
> [image: image.png]
>
> regards,
>
> --
> * Eugene*
>
> --
> 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/CABxpZHuY_zoSvcwQL79UPts6g%3DmJRD%3DO_B%2Bc5%3DvinOtPKNLFLw%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/CAHs1H7vL%3Dzawt%2BqPiBU1qrZojSLpdjZuMWYiWT3jic-8dZfTEw%40mail.gmail.com.


Re: Folder structure for a Django project that has multi functional module.

2021-05-12 Thread Ammar Mohammed
Separating every functional module is the right way !
You should build your website on a base module using oop and structural
method.

Good luck


On Wed, May 12, 2021, 06:43 Salima Begum 
wrote:

> Hi,
> We initially developed our project with the following folder structure;
>
> [image: old_folder_structure.PNG]
>
> As shown in the above image we have developed and integrated everything
> into a few files. Since the functionality is growing we are planning to
> separate each functional module as an individual app folder structure. That
> means module A(app A)  will have its own default .py files that includes
> its own models.py and views.py, whereas in the previous case everything is
> under one app folder( just like what is seen in above image). So the new
> folder structure is created as shown in the image below.
>
> [image: new_folder_structure.PNG]
>
> We think the new structure is going to have more advantages, like
> performance, files organization and etc., but we really want to check with
> experts in this community. We appreciate your valuable opinion and any
> other suggestions to improve.
>
> Thanks
> ~Salima
>
>
> --
> 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/CAMSz6b%3D5NLDcBwuvNn6_119T2SarYYpt0U-byv1qDYxmtRSLTA%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/CAHs1H7t7P5wPhuVSOG7kSMJSTh5cKTuU9OU6WGHjcagyVr9bEg%40mail.gmail.com.


Re: need help integrating SSL with react/django web app

2021-05-08 Thread Ammar Mohammed
I am using Nginx as a proxy for my Django app and this method is working
just fine.

On Sat, May 8, 2021, 11:14 Ammar Mohammed  wrote:

> I think you're supposed to install the certificate in your web server
> (Nginx, Apache).
> Follow the manual to install it to your server and everything will be fine.
>
> On Sat, May 8, 2021, 10:35 John McClain  wrote:
>
>> Hello,
>>
>> I am having difficulties connecting SSL to my React/Python webapp
>>
>> I am trying to integrate the PWA and am having difficulties getting the
>> SSL to adopt to the app.
>>
>> Does anyone have experience with this?
>>
>> Cheers
>>
>> --
>> John McClain
>>
>> Cell: 085-1977-823
>> Skype: jmcclain0129
>> Email: jmcclain0...@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/CAN-hv_qHS2wdhuwYQLob1C_uM8vgfpbqnvxGke5oy8CyuT551g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAN-hv_qHS2wdhuwYQLob1C_uM8vgfpbqnvxGke5oy8CyuT551g%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/CAHs1H7stQG2aqWD95LxH3PSUGaijRYL0%2BEmGCWC2s57A4dJwBw%40mail.gmail.com.


Re: need help integrating SSL with react/django web app

2021-05-08 Thread Ammar Mohammed
I think you're supposed to install the certificate in your web server
(Nginx, Apache).
Follow the manual to install it to your server and everything will be fine.

On Sat, May 8, 2021, 10:35 John McClain  wrote:

> Hello,
>
> I am having difficulties connecting SSL to my React/Python webapp
>
> I am trying to integrate the PWA and am having difficulties getting the
> SSL to adopt to the app.
>
> Does anyone have experience with this?
>
> Cheers
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@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/CAN-hv_qHS2wdhuwYQLob1C_uM8vgfpbqnvxGke5oy8CyuT551g%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/CAHs1H7uEcZpRjUrPawkchg1ACS-2OR2R7t2OW8FG9jPdF0B-hg%40mail.gmail.com.


Django Rest Framework APIView request

2021-02-01 Thread Ammar Mohammed

Hi everyone i have an API View inherited from another class 
i want to create a new app that reciver the current Client requests and 
process it then pass it to the original View 
(all i want to do is to recive the view from the user (the user will use 
the original urls without any edit in the clients) then i want to add some 
value to one of the request variables and redirect it to the original 
APIView)

-- 
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/c8b3c72e-6664-4aff-b427-69d2933b3ec5n%40googlegroups.com.