Question for Upload images issue

2021-11-23 Thread Alam Khazi
Hi,
By using Vuejs, Axios and Django, we're uploading "multiple images" using
Vuejs form in one upload/browse attempt. After uploading, the images are
getting in a list and then the list of images names are stored into backend
in ImageField.  The image names are saving into database but not saving
into Media Folder. Here is snippet of the code.

Vuejs
```
  
Files


  {{ name }}

  
  

  
  
  Submit
```
Axiox
```

new Vue({
  el: '#app',
  data() {
return {
  files: [],
  images: [],
}
  },
  computed: {
filesNames() {
  const fn = []
  for (let i = 0; i < this.files.length; ++i) {
fn.push(this.files.item(i).name)

  }
  return fn
}
  },
  methods: {
handleFileUploads(event) {
  this.files = event.target.files;
  this.images = [...this.files].map(URL.createObjectURL);
},
submitFile() {
  let formData = new FormData();
  for (var i = 0; i < this.files.length; i++) {
let file = this.files[i];
formData.append('files[' + i + ']', file);
  }
 submitForm: function(){
  let formData = new FormData();
  const fna = []
  for (let i = 0; i < this.files.length; ++i) {
fna.push(this.files.item(i).name)
  }
  console.log('fna');
  console.log(fna);
axios({
method : "POST",
url: "{% url 'service-ad' %}",
headers: {'X-CSRFTOKEN': '{{ csrf_token }}',
'Content-Type': 'multipart/form-data'},
data : {
"images": fna,
},
  }).then(response => {
console.log('SUCCESS!!');
  }).catch(err => {
console.log('FAILURE!!');
  });
}
  }
})

```
Where as in other case we have similar functionality of uploading
'multiple images' in one upload/browse attempt, but here, we are using HTML
form and the images names are saved in database as well as in Media Folder.

Django
```
def servicevue(request):
if request.method == "POST":
data = json.loads(request.body)
images = data['images']
img_length = len(images)
if img_length == 1:
image_name = images[0]
image_name2 = ''
elif img_length == 2:
image_name = images[0]
image_name2 = images[1]
else:
image_name = ''
image_name2 = ''

savehotel = Hotel(
  image=image_name,
  image2=image_name2,
  )
savehotel.save()
messages.success(request, """Your Ad is successfully posted.""")
return JsonResponse(safe=False)
return render(request, 'servicead.html')
```
So we are wondering what could be the issue. We hope our code is correctly
implemented. Please help me out whether this is any way to unblock this
issue?

Best regards,
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/CABscGkRXhvC6zALxCXvQN6-DmB%2BxedTSWO8KrPS2Nih0imZtXA%40mail.gmail.com.


Multiple image upload using Django, Vuejs and Axiox

2021-11-19 Thread Alam Khazi
Hi,
By using Vuejs, Axiox and Django, Uploading multiple images. After
uploading images are getting in list and then those list of images names we
are storing into backend in ImageField image is saving into database but
not saving into media folder.


['nature6.jpg', 'nature5.jpg', 'nature4.jpg', 'nature3.jpg', 'nature2.jpg',
'nature1.jpg', 'nature.jpg']
```
if request.method == "POST":
# From template we are fetching values
data = json.loads(request.body)
images = data['images']
saveform = vk_service(image=images[0],
image2=images[1],
 image3=images[2],
 image4=images[3],
 image5=images[4],
 image6=images[5],)
```
Images are saving into database but not saving in media folder.
Please help me out to solve this issue.

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/CABscGkSJ66hXxyOOZYfLSbaAH-Wc89QogQXX%3DVeMFheghJJp2A%40mail.gmail.com.


Re: Hiring for frontend developer

2021-05-02 Thread Alam Khazi
Hi sir. I am looking for UI developer job and I have experience of 1.5 year
in UI with vue.js

On Mon 3 May, 2021, 2:05 AM m rekha,  wrote:

> Hii sir,
>  Iam intersted to work frond end developer.I'm completed UI and python
> sir.how I contact u sir?
>
> On Mon, May 3, 2021, 1:49 AM talha qamar  wrote:
>
>> Hi sir can we chat on what's app for front end developer job.
>> +923419174036
>>
>>
>> On Sun, May 2, 2021, 2:34 PM Rama akki  wrote:
>>
>>> Dear friends,
>>> We are hiring for frontend developer for our start-up. I look forward to
>>> have better team members. Kindly forward your friends who are suitable for
>>> this position.
>>>
>>> Regards
>>> Ramashankar
>>>
>>> --
>>> 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/CAAmXcB4u37EctSr7zcMyXbwX%3DWGJsb94sf-KrxOxH4-ertwQfw%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/CAJEPo9hYMRzDs%3DCQc6YQrNk4eap3YRG2wW9HteuA-zGU_5%3DP8Q%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/CAAqGB-Xh9bOcX9VdnbwaZv7E8MXMAqt9b-wSS_x4NduLGs21WA%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/CABscGkR9D_1%2BBwcpYZSZqgLtSen1HL6t%3DMgB%2B4qdyAQsKTxzsw%40mail.gmail.com.


Re:

2021-02-01 Thread Alam Khazi
Thank you chetan I will try it out and let you know

On Tue, Jan 26, 2021 at 7:58 PM Chetan Ganji  wrote:

>
> Hi Salima,
>
> Couple of things you can change in the code to make it run faster!
> Do these changes and performance will definitely improve.
>
> 1.Queryset
>
> Problem:
> classifieds =
> vk_classifieds.objects.filter(class_status='1').order_by('-added_date')
> This will fetch all the entries in the table; if there are million records
> in the table,
> all of them will be fetched, which is not required at all!
>
> Processing them will consume resources on the server which is unnecessary
> calculation!
> Avoid it!
>
> Solution:
> classifieds =
> vk_classifieds.objects.filter(class_status='1').order_by('-added_date')[:page_size]
>
> Only fetch what you need! As your page size is 40 actual query will look
> like below.
> classifieds =
> vk_classifieds.objects.filter(class_status='1').order_by('-added_date')[:40]
>
> 2. Calculation on every request
>
> 2.1 classifieds_dist
> Distance between two zipcodes is not going to be changed! You dont have to
> calculate on every request.
> Calculate it only once when the new classified is created and store it in
> a separate table.
> This calculation must be done using a celery task.
>
> Every time zipcode of classified is updated or user updates his zipcode,
> this distance has to be updated.
> You have to put restrictions on how many times a user can change his
> zipcode.
> Otherwise you could end up paying hugh money to the api providers!
> This updation must be done using a celery task.
>
>
> 2.2 diff_time
> I dont know the code and complexity of it.
> However as it is going to be required on every request find a way to
> calculate it once and store in a separate table.
>
> Let me know if they are helpful or not!
> Cheers!
>
>
> On Thu, Jan 21, 2021, 9:35 AM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> We are building website, Here I have written functionality for
>> classifieds page.
>> It is loading to slow because of We are prompting distance calculation in
>> classifieds page. By using distance API matrix based on logged in user zip
>> code and individual Ad zip codes from query set(database).
>>
>> ```
>> def classifieds(request):
>> global dict_time
>> try:
>> dict_time = {}
>> email = request.session.get('email')
>>
>> # Here we are displaying the classified ads "order by date".
>> The ads will be sorted by latest date.
>> classifieds =
>> vk_classifieds.objects.filter(class_status='1').order_by('-added_date')
>>
>> count =
>> vk_classifieds.objects.filter(class_status='1').order_by('-added_date').count()
>> for i in classifieds:
>> # diff_time is a child method. By passing 'i' as object
>> in diff_time.
>> difrnc_date = diff_time(i)
>> dict_time[i.id] = difrnc_date
>>
>> # Pagination for classifieds page.
>> # classified = random.sample(list(classifieds), k=count)
>> # print("classified = ", str(classified))
>> # By default first page
>> page = request.GET.get('page', 1)
>> # print("page = ", str(page))
>> # Per page setting 40 objects.
>> paginator = Paginator(list(classifieds), 40)
>> # print("paginator = ", str(paginator))
>> classified_p = paginator.page(page)
>> # print(classified_p)
>> except PageNotAnInteger:
>> classified_p = paginator.page(1)
>> except EmptyPage:
>> classified_p = paginator.page(paginator.num_pages)
>> except Exception as e:
>> logging.error(e)
>> return render(request, "classifieds.html",
>>   {"Classifieds": classified_p,
>>  # distance calculation
>>"distance": classifieds_dist(email),
>>'some_date': dict_time,
>>})
>> return render(request, "classifieds.html", {"Classifieds":
>> classified_p,
>> "distance":
>> classifieds_dist(email),
>> 'some_date':
>> dict_time,
>> })
>> ```
>>
>> ```
>>
>> def classifieds_dist(email):
>> global frm, km
>> dict_distance = {}
>>
>> qury = vk_customer.objects.filter(email=email).first()
>>
>> # From above qury variable we are getting zip of customer.
>> frm = qury.Zip
>> # importing json package to calculate the distance
>> url = "
>> https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial;
>> headers = {
>> 'Authorization': "Bearer somevalue",
>> 'User-Agent': "some value",
>> 'Accept': "*/*",
>> 'Cache-Control': "no-cache",
>> 'Postman-Token': "some value",
>> 'Host': 

Re: 'str' object is not callable

2020-09-23 Thread Alam Khazi
Thank you I will try that.

On Wed 23 Sep, 2020, 9:38 PM Avi shah,  wrote:

> Try adding ''' as it can only take one string as parameter , ''' ''your
> message'' . '' your message 2 '' '''
>
> On Wed, Sep 23, 2020 at 9:24 PM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I am getting this error. May I know the reason why this error occurred?
>>
>> Here I attached two screenshots please review and let me know.
>>
>> Thank you
>> ~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%3DgkYNkLXb6foQWr-vO5ZeU%3Draix-wp2rCNU3_eO2BxEg%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/CALa7AFMcbvsLjdKDqquKw6YKiikDDyqTQEBjcNGY_fmFnVGf%2BA%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/CABscGkRc-3FJeBs9vtHoWcvbbOD7xA5r15DdmHZCXktcfcGRkw%40mail.gmail.com.


Re: Recruitment

2020-09-23 Thread Alam Khazi
I am interested

On Wed 23 Sep, 2020, 9:07 PM Harish Thiyagharajan, <
harishthiyagh...@gmail.com> wrote:

> mail me your questions , or call me or what's app, if it is a call , I
> suggest that you do it today, the more you late , the more your loss,
> already 5 applicant on the go, so please make it fast.
>
>
> On Wed, Sep 23, 2020 at 8:13 PM Anh Nguyen  wrote:
>
>> I’m, interested!
>>
>> On Sep 23, 2020, at 14:23, Harish Thiyagharajan <
>> harishthiyagh...@gmail.com> wrote:
>>
>> I want a interested django user , DM mail for more details , all the
>> details including payment can be discussed ...looking for for you guys .
>>
>> --
>> 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/7b7956bc-d239-4b63-9194-0644b8a6eeben%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/CE1F0D68-DFB1-43DF-BF25-269F030896FD%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/CAHg_i8hY%3Dywd12rvMVmDebSoWOR%2BxHwMx%2BApqo%3DybdAb7RU-vg%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/CABscGkTwaa81yXkhssPjmunSNRqvU6mYy3Kn7B4Yxys0Q%2BH8qg%40mail.gmail.com.